-
Contributing Member
radiobuttons problem....
In my webpage form i am using 5 radio buttons. user saw the different fields according to the selection of radiobuttons. How can i aceive this one? becasue all the radiobuttons have the same name. In select box there is a option to find SelectedIndex. Is ther any option here ?
---------------------
suresh
-
Contributing Member
Re: radiobuttons problem....
Hi Friends i solve this problem just now...I want to share my experience.
Using the following code you can do it...
if(document.formname.radiobuttonname[0].checked)
{
do your code here.
}
The above code is working fine....If you have anyother idea post here..
waiting for your reply..
-----------------------
suresh
-
Expert Member
Re: radiobuttons problem....
hi suresh
i amnot getting ur question exactly!though u have answered it, please tell me where to use exactly.
what i mean is that though the radio buttons have same name, they have different values , right?
so cannot we do the same by using
String ss[]=getParameterValues("name");//name is name of radio button
and use some loop
and doing if(ss[i].cehcked ==true)
{ur code;
}
arenot they same?
Also please tell regarding how to use CHECKBOXES and COMBOBOX
expecting good answer!bye
-
Contributing Member
Re: radiobuttons problem....
hi vmshenoy,
The main use of radiobutton is user allowed to select only once in the list of options. If you use same name of all the radiobuttons then only you acheive the above. Ohterwise user select multiple options. Checkbox do the second one.
At that time of writing this question i don't know how to write the code for getting the user selected button value. For example if we use four radiobuttons science, maths, english, tamil. These are all radiobutton values. All the radiobutton has the same name subject. If user select science we show some of code. If he select maths we show another different code. Here i want the value of user selected radiobutton.
Previously i know only to check whether user select a any one of the radiobutton or not. But i don't know how to get the exact selected radiobutton value.
I am writing the javascript code... I think you expect the javacode. am i correct?
--------------------------
suresh
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules