jQuery in Action, 3rd edition
The moose likes JSF and the fly likes javascript value to JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "javascript value to JSF" Watch "javascript value to JSF" New topic

javascript value to JSF

Shruthi Sam
Ranch Hand

Joined: Jul 09, 2008
Posts: 73
I have a jsf page with a hidden field. In the javascript am setting the value of the hidden component. whenever i submit this, am not getting the value of the hidden field set by javascript. Please let me know how to achieve this. (I want to pass a javascript value to my bean.)
Pardha Reddy

Joined: Mar 11, 2010
Posts: 17

var varName = document.getElementById(formName+":hiddenField1"); // Here hiddenField1 is id attribute of hidden field.

This is how variable be assigned to hidden field in javascript. Cross check your syntax once.

Vaibhav Mittal

Joined: Jun 11, 2008
Posts: 23
refer to this link. It describes everything you need to know on this topic very clearly.

"Life is good"
Shruthi Sam
Ranch Hand

Joined: Jul 09, 2008
Posts: 73
Hi Vaibhav & Pardha,

Thanks a lot for your replies. It is working now. Thanks again.
It is sorta covered in the JavaRanch Style Guide.
subject: javascript value to JSF
It's not a secret anymore!