Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How to read values from Radio Buttons

    Hi,

    I'm new to java.

    I'm trying to submit a URL from a Form, the user has to choose between 3 different URLs that are displayed as radio buttons.
    So the user can only choose one of them.

    After that I'd like to pass the selected button's value to a function which will read the value and append that string to another string to form a complete URL.

    I'd appreciate it if any one could help


    Regards,

    Omare

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, if the form's submit method is GET then you don't need to use a function. The value for the radio button object will already appear in the URL as part of the querystring.

  • #3
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanx,

    it is actually a GET, but I append the 2 strings before submitting the form, so I send the complete URL like this

    top.location.href = './'+R1+D2+'.htm';

    where R1 is the value of the radio button, and D2 is the rest of the URL

    how do I call the radio object?, that´s what´s still unclear to me.
    I don't know how to assign the button's value to the R1 variable.

    I know I must look like a complete idiot to you. I'm really ignoratn at this.

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    var R1 = document.forms[0].radio1.value;

    <form>
    <input type="radio" value="choice1" name="radio1" />
    <input type="radio" value="choice2" name="radio1" />
    <input type="radio" value="choice3" name="radio1" />
    </form>

  • #5
    New to the CF scene
    Join Date
    Aug 2002
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That did it!!

    thank you so much.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •