This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSF and the fly likes Select one radio button and display the value in java script Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Select one radio button and display the value in java script" Watch "Select one radio button and display the value in java script" New topic
Author

Select one radio button and display the value in java script

jose chiramal
Ranch Hand

Joined: Feb 12, 2010
Posts: 266
This is my jsp code (i have pasted only the required portion)


Javascript code :

var1=document.getElementById("adminPanel:adminForm:rptType"); // this gives me a HtmlTAbleObject
alert(var1.value); // gives me a null value here . i presume sthg wrong in the above statement..

Kindly advise how I can get the value of the radio button thats clicked from inside my javascript function.
Is it mandatory to use binding or value along with <h:selectOneRadio to get the button thats clicked..???
H Jetly
Ranch Hand

Joined: Aug 26, 2010
Posts: 41

First please you use a managed bean.
Second the value attribute of the selectOne... will contain the selected value (for eg


should be

please use the managed bean.


Harsh Jetly
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Select one radio button and display the value in java script