This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "javascript value to JSF" Watch "javascript value to JSF" New topic
Author

javascript value to JSF

Shruthi Sam
Ranch Hand

Joined: Jul 09, 2008
Posts: 73
Hi,
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
Greenhorn

Joined: Mar 11, 2010
Posts: 17

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

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

Thanks
Pardha
Vaibhav Mittal
Greenhorn

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.
 
wood burning stoves
 
subject: javascript value to JSF