Enable/Disable form elements

A

Age Bosma

Hi,

I've got a serie of radio options in a form, if the last option gets
selected I want it to Enable a different (text) form field.
Is it possible to monitor if a radio button in a form get's unselected
instead of supplying the same piece of JavaScript code for each other
radio option?

Situation:

<fieldset>
<legend><b>7. Are you still alive?</b></legend>
<input type="radio" name="q7" value="yes"
onclick="document.surveyform.nocodec7.disabled=true;" />Yes<br />
<input type="radio" name="q7" value="abit"
onclick="document.surveyform.nocodec7.disabled=true;" />A little bit<br />
<input type="radio" name="q7" value="no"
onclick="document.surveyform.nocodec7.disabled=false;" />No, because:
<input type="text" name="reason7" disabled />
</fieldset>

Now, in this example the text field is Disabled by default, if the
option "No" is selected this field gets activated.
If any of the other options are selected it will Disable the text field
again.
Although this is perfectly working I'm interested to know if it isn't
just possible to execute some piece of code as soon as option "No"
becomes deselected.

Age Bosma
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top