• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to capture a radio button value

 
ushank
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have two diffrent table in form and 2 radio button for each table, I have to do one section of functionality on select of radio button I know for sure that the capturing the radio value should do the trick.
but how do I do that using a small javascript function is my approach right to capture the radio button value and do the necessary functionality, can anyone give some snippets of js pls?
Thanks in advance
 
jyothsna kumari
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai
u can give names to the radiobuttons as say rb1.
then use (request.getParameter("rb1")!=null) to read whether the radiobutton is checked or not.if it is not checked it returns null.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ushank first off your name does not fit the namig policy of the ranch, you can change your display name under the my profile link above.
Now for an answer.
here is a simple loop
for (i=0;i<RadioGroupName.length;i++){
if(RadioGroupName[i].checked){
YourValue = RadioGroupName[i].value;
}
}
See if that helps you out
Eric
 
ushank
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
but I have assigned the radio buttons as type= radio name =b1 for both the radio button and I believe they are in group but is there any other way to define them as a group.
I have used the earlier piece of code in a function, and I'm checking int he block as if(checkRadio()!= null) then do these actions.
pls correct me if this is wrong.
thanks
I shall change my user name soon my name is ushanki I have cut short i.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Group is their name
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic