| Author |
how to capture a radio button value
|
ushank
Greenhorn
Joined: Aug 04, 2003
Posts: 6
|
|
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
Joined: Jul 21, 2003
Posts: 108
|
|
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
Joined: Nov 08, 2001
Posts: 15357
|
|
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
Joined: Aug 04, 2003
Posts: 6
|
|
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
Joined: Nov 08, 2001
Posts: 15357
|
|
|
The Group is their name
|
 |
 |
|
|
subject: how to capture a radio button value
|
|
|