Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text boxes validated by pressing radio button

Status
Not open for further replies.

Harshmellow

Programmer
Mar 28, 2002
18
BR
Hello!

I need to know ASAP what must I do to let the user view a text box shaded and can not write on it, until he presses a determined value of a radio button.

Thanks in advance folks, :)
 
.....huh? "blah blah blah blah blah..."-Dennis Quaid
 
shaded is "disabled" to make it change on the focus of a radio/check box will require some scripting, I did see something along these lines somewhere but will have to rack the old grey matter to find it.

The secret of life is honesty and fair dealing. If you can fake that, you've got it made.
Groucho Marx (1895-1977)
 
Here's something you can play around with:

<html>
<head>
<title>Untitled</title>
<script>

function tarv(inVal) {
if (inVal == 'yes') {
frmTest.txt1.disabled = false;
frmTest.txt1.focus();
}
else {
frmTest.txt1.disabled = true;
frmTest.txt2.focus();
}
}

</script>
</head>
<body>
<form name=&quot;frmTest&quot;>
Value 1: <input type=&quot;text&quot; name=&quot;txt1&quot; value=&quot;Hello&quot; disabled=&quot;true&quot;><br>
Value 2: <input type=&quot;text&quot; name=&quot;txt2&quot;><br>
Enable <input type=&quot;radio&quot; name=&quot;radio1&quot; onClick=&quot;tarv('yes');&quot;>
Disable <input type=&quot;radio&quot; name=&quot;radio1&quot; onClick=&quot;tarv('no');&quot; checked>
</form>
</body>
</html>

You could also look into the onFocus and onBlur events of the radio buttons trigger actions.
 
hey sweevo and all of you who took some time to answer: thank you! It works fine for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top