Toggle active state of textbox with a radio button
I have 5 radio buttons. A B C D E
B (if selected) needs to activate a text field of 25 chars
E (if selected) needs to activate a text field of 10 chars
if user selects B, then user can type in "happy"; user then changes mind and selects D. "happy" is erased and the textfield is disabled. user then changes mind again and selects B and this time types in "not so happy"; then user changes mind selects E and types in "whatever" (B is blanked and disabled). then user selects A and hits submit. (B and E should be blanked and disabled... form returns value A as submited.
cheap example of using one checkbox to toggle one textbox... blah!
<html><head><title>Toggle My Text Box</title>
<script language="JavaScript">
function textme () {
if(document.f1.mycheckbox.checked)
{
document.f1.textinput.disabled=false;
}
else
{
document.f1.textinput.disabled=true;
}
}
</script>
<form action="" method="" name="f1">
<input type="text" disabled size="10" name="textinput">
<input type="checkbox" onclick="textme()" name="mycheckbox" value="on" >
<br>
<input type="submit" value="Add">
<input type="reset" value="Clear">
</form>
</body></html>
__________________
In a world of give and take, take all you can and you die with nothing. Give all you can and you die with honor.
|