Results 1 to 3 of 3

Thread: Disabling Text on Radio Click [resolved]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Posts
    492

    Resolved Disabling Text on Radio Click [resolved]

    I have several radio buttons on my site with the following tags.
    HTML Code:
    <INPUT TYPE="radio" NAME="index_Radio" VALUE="Radio A" SELECTED>
    <INPUT TYPE="radio" NAME="index_Radio" VALUE="Radio B">
    <INPUT TYPE="radio" NAME="index_Radio" VALUE="Radio C">
    Then I have and input field with the following tag.
    HTML Code:
    <div id="first_name">
    First Name:&nbsp; 
    </div>
    <INPUT TYPE="text" NAME="first_name" SIZE="20" MAXLENGTH="10" ONCHANGE="this.value = this.value.toUpperCase()">
    What do i need to do to have the First Name label and the text box disabled when I click on Radio A. And have it enabled when i click on B or C. Keep in mind that when the page loads A is selected already. So it needs to load disabled.

    Thanks for you help
    Last edited by mrstuff68; Jan 4th, 2006 at 10:48 AM.

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Disabling Text on Radio Click

    You need to catch onclick on all three radios. See which one is selected. If it's A, disable the text field, otherwise enable it. On page load, do the same. (If you put the disabled attribute on the text field, it would be disabled on load, but if the user has JS disabled, it would stay so, which is not good.)
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Posts
    492

    Re: Disabling Text on Radio Click

    Got it working.

    Thanks.

Posting Permissions

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



Click Here to Expand Forum to Full Width