Make text box avaialble only if radio button selected?
Here is my quiz:
http://www.housing.uwaterloo.ca/surveys/quick-quiz2.php
See the text box next to Other: in the first question? What I need to do is make it so that they can only enter text in the text box if they have selected the radio button for "other".
What would be the best way to do this?
timjpriebe posted this at 15:34 — 4th April 2007.
He has: 2,667 posts
Joined: Dec 2004
The only way I've personally found to do it is Javascript.
So that it's still accessible without JavaScript, start with the field enabled, which is the default. In pageload, check to see if the Other option is selected, then set the textbox to disabled if it isn't. Then, for each option in that question, put an onclick call to a javascript function. In that function, determine which is selected, and take the appropriate action.
I always delete the current contents of the textbox if the answer changes away from Other, too. That helps avoid any confusion on the user's part.
Tim
http://www.tandswebdesign.com
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.