Results 1 to 4 of 4

Thread: radiobuttons problem....

  1. #1
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    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


  2. #2
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    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


  3. #3
    Expert Member
    Join Date
    Oct 2005
    Answers
    383

    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

    :)
    NEVER SAY DIE.

  4. #4
    Contributing Member
    Join Date
    Sep 2006
    Answers
    962

    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
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact