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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Filling a text box based on whether a radio button gets selected or not

    Hi all,

    I am a beginning at JavaScript and am at a loss on how to achieve the following.

    I have one question labelled Q1. This question has the options Yes and No by way of a radio button. If the user selects Yes I want to fill a single text box with the text "1" to indicate Q1 has been answered.

    Any ideas?

    Kind Regards,

    Matthew





    in a form. Each question consists of two radio buttons, Yes or Noa single radio button with option Yes or No.

  • #2
    Regular Coder Vincent Puglia's Avatar
    Join Date
    Jul 2003
    Location
    where the World once stood
    Posts
    367
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Code:
    <html>
    <body>
    <form name="theForm">
    <input type="radio" value="1" name="theRad" onclick='this.form.theText.value = this.value'>
    <input type="radio" value="" name="theRad" onclick='this.form.theText.value = this.value'>
    <input type="text" name="theText">
    </form>
    </body>
    </html>
    Vinny
    Where the world once stood
    the blades of grass
    cut me still

  • #3
    New to the CF scene
    Join Date
    Apr 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thanks!

    Thanks Vinny

  • #4
    Regular Coder Vincent Puglia's Avatar
    Join Date
    Jul 2003
    Location
    where the World once stood
    Posts
    367
    Thanks
    0
    Thanked 13 Times in 13 Posts
    You welcome, mtkirwan

    Vinny
    Where the world once stood
    the blades of grass
    cut me still


  •  

    Posting Permissions

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