Meaningless Drivel is fun!*
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 Android Security Essentials Live Lessons this week in the Android 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: 15

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.
 
jQuery in Action, 2nd edition
 
subject: javascript value to JSF
 
Similar Threads
passing hidden field value to backing bean
How to get the managed bean property value inside the javascript method in facelets?
inputHidden causing conversion problems
Accessing JSF stuff from another servlet
Question on how to fix error on inputHidden field