1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Oct 2010
    Rep Power

    Help getting value of textbox

    I have a form that uses a bunch of radio buttons, where I give each radio button a value. The radio button that is marked other has a textbox next to it and we need that amount as the value of the radio button. How do we do this?
    here is a piece of the sampled code:
    <input name="Ecom_Cost_Total" type="radio" class="donate_check" value="50" />
    <div class="donate_title">Friend </div>
    <div class="donate_amount"> $50</div>
    <div class="donation_option">
    <input name="Ecom_Cost_Total" type="radio" class="donate_check" id="other" value="other" />
    <div class="donate_title"> Other </div>
    <div class="donate_amount">
    <input name="donate_amount_us" type="text" id="donate_amount_us" size="5" maxlength="5" onchange="javascript:document.forms(0).Ecom_Cost_T otal.value = document.activeElement.value" /></div>
    The form is taking the values frm "Ecom_Cost_Total" and is then saying that the amount is invalid.
  2. #2
  3. Moderator From Beyond
    ASP Mastermind (5000+ posts)

    Join Date
    Sep 2004
    Rep Power
    You can use the textbox onblur event and the ID of the radio button:
    <input name="donate_amount_us" ... onblur="document.getElementById('other').value = this.value;" />
  4. #3
  5. No Profile Picture
    Contributing User

    Join Date
    Jun 2011
    Pasig City, Philippines
    Rep Power
    Hi, Yocheved Kahn!

    You can have a condition statement when the "Other" radio button is checked and then get the value of the textbox.
    There are several ways to do that. You can either use:

    PHP with the $_POST or $_GET methods

    jQuery with the val() function
    Javascript with the document.getElementById() method

    You can refer to these:

    How to get textbox value with jQuery
    PHP Tutorials: Getting values from a Text Box
    Using getElementById in Javascript
    HTML DOM Input Radio checked Property
    HTML DOM getElementById() Method

    I hope this helps. Thank you.

Similar Threads

  1. Pass value from unbound textbox to bound textbox
    By mustish1 in forum Microsoft Access Help
    Replies: 2
    Last Post: October 27th, 2006, 03:08 PM
  2. Replies: 3
    Last Post: October 12th, 2006, 10:03 AM
  3. Textbox to populate another textbox
    By ddennis in forum Microsoft Access Help
    Replies: 2
    Last Post: August 3rd, 2005, 06:27 PM
  4. Inserting data into mdb file
    By XandarX in forum ASP Development
    Replies: 14
    Last Post: May 18th, 2005, 01:49 PM
  5. Locked property of a Forms 2.0 TextBox Not Working...
    By TheMadCoder in forum Visual Basic Programming
    Replies: 3
    Last Post: July 1st, 2004, 04:37 PM

IMN logo majestic logo threadwatch logo seochat tools logo