View Full Version : button disable until text entered

03-11-2004, 07:17 PM
I have one form that looks kinda like this:

<form name="Infant">
<p>What method did Lewis and Brooks-Gunn use to test infants’ self-recognition?</p>
<p><input name="Inf1" type="text" size="60" onFocus="enbutton()"></p>
<p>What behavior indicates that infants recognize themselves (have a mental image of their own faces)?</p>
<p><input name="Inf2" type="text" size="60"></p>
<p><input type="button" name="check" value="Check Answers" onClick="winInf()"></p>

and another form that is within a table.
I have disabled the "Check Answers" buttons for both forms from a java code with onload.

But now I'm trying to re-enable the button for the current form when the user starts typing in one of the textboxes of that form... I've tried some code (as evidenced by the enbutton() function) but I keep running into errors, what should I be doing?

Willy Duitt
03-12-2004, 02:01 AM
You kinda forgot to include your script which shows how your are disabling the button. Without that. There is not much we can offer in the way of a solution.


03-12-2004, 06:09 AM
<p><input name="Inf1" type="text" size="60" onkeydown="this.form.check.disabled=(this.value!='')?false:true"></p>

03-17-2004, 01:53 AM
Thanks for the help... I figured out how to re-enable the buttons directly within the forms after much more struggle.