www.webdeveloper.com
Results 1 to 4 of 4

Thread: Validate a text field with radio button

  1. #1
    Join Date
    Nov 2008
    Posts
    2

    Validate a text field with radio button

    Hi all,

    First of all I appreciate in advance any attempt to help me.

    I am new at scripts and I have a important project to develop and I was wondering if someone can help me.

    I have a form with few radio buttons, a text field and a submit button.

    My objective is to make that when selected a radio button the text field gets a specific URL.
    Basically I have a few databases URLs and I want that when a specific radio button is selected (one database), the text field selects that URL and search on it.

    Thank you all again!

    candeias

  2. #2
    Join Date
    Feb 2008
    Posts
    1,666
    No change is required to the following except to specify your url and the name in red must reference the name of the target text field:
    Code:
    <input type="radio" name="radioButtonName" value="someurl"
     onclick="textFieldName.value = this.value; return true;">

  3. #3
    Join Date
    Nov 2008
    Posts
    2
    Hi,

    First many thanks for helping. Really!

    About your code, I had integrated it and when the radio box is selected, replies the url into the text field.

    What I want is, have a few radio buttons(all of them with different urls associated), a text field and a submit button. Select a radio button and make a search on the text field.

    Many thanks again MrNobody.

    candeias

  4. #4
    Join Date
    Feb 2008
    Posts
    1,666
    So just duplicate this part into each radio button:

    onclick="textFieldName.value = this.value; return true;"

    You could also create a function out of this if you want to save a few bytes of bandwidth.

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