www.webdeveloper.com
Results 1 to 4 of 4

Thread: need to display radio button value.

  1. #1
    Join Date
    Jul 2011
    Posts
    3

    need to display radio button value.

    Hi, I have a form with 5 radio buttons. Each of them has an integer value. and below I have a text form field which is read only. When a radio button is selected, I need its value to be displayed in that field. Can someone help me?

  2. #2
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,674
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    </head>
    
    <body>
    <form>
    
    
    
    <input type="radio" name="" value="1" onmouseup="this.form['fred'].value=this.value;" />
    <input type="radio" name="" value="2" onmouseup="this.form['fred'].value=this.value;" />
    <input type="radio" name="" value="3" onmouseup="this.form['fred'].value=this.value;" />
    <input type="radio" name="" value="4" onmouseup="this.form['fred'].value=this.value;" />
    <input type="radio" name="" value="5" onmouseup="this.form['fred'].value=this.value;" />
    
    <input name="fred"/>
    
    </form>
    </body>
    
    </html>
    Vic

    God loves you and will never love you less.

    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. #3
    Join Date
    Jul 2011
    Posts
    3
    Thanks a lot! that's exactly what I wanted!

  4. #4
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,373
    The make the radio buttons not 'stick', add a value to the name attribute of the element.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles