File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Select one radio button and display the value in java script

 
jose chiramal
Ranch Hand
Posts: 266
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
Google Web Toolkit Redhat Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic