Results 1 to 2 of 2

Thread: Question about radio inputs

  1. #1
    Join Date
    Jul 2010
    Posts
    4

    Question about radio inputs

    i have a form right now asking the cost to an event, to make it easier for user to enter, i made it into two radio input options. The first option being "free", and the second option being an input box for user to enter a price.

    so i want the functionality such that
    1. when I click the input box, the radio button will be automatically selected
    2. the second radio option will take on the value of the number i entered


    So far I have:
    <input type="radio" name="cost" value="0" />Free!<br />
    <input type="radio" id="cost1" name="cost"" /><input type="text" name="name" size="20" onclick="document.getElementById('cost1').checked=true" />

    I don't feel like the value from the input box will be passed to the form, what's the correct/conventional way of doing this?

    Thanks!

  2. #2
    Join Date
    Dec 2009
    Location
    Reno
    Posts
    222
    You can just have the text input the same name as the radio and have the radio without value; the element's value will come from the text input...

Similar Threads

  1. Website with radio streaming
    By Caspersky12 in forum General Questions
    Replies: 1
    Last Post: 01 Jul 2009, 01:41 PM
  2. php radio button form for a poll
    By ketanco in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 27 Sep 2008, 04:03 PM
  3. A question of content
    By revrandysausage in forum General Questions
    Replies: 0
    Last Post: 26 Sep 2005, 02:25 PM

Posting Permissions

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