November 10th, 1999, 10:03 PM
-
Hi!
Is there a way to disable an existing button (I've used the tag <INPUT TYPE="submit"> ) when text input field has no value in it.And enable it when a value is entered.Or can it be done using <INPUT TYPE="button">.
Thanks.
------------------
November 18th, 1999, 08:40 AM
-
I'm not sure about disabling the button, but one thing you can do is to make a for loop which checks to see if it has a value, and if it doesn't, display a message and not do anything until all fields are filled.
Here's an example:
var filledField;
for (var i = 0; i < document.yourForm.elements.length; i++) {
if (document.yourForm.yourTextbox != "") {
filledField++;
}
if (filledField < numberOfFields) {
alert("Please fill out all fields before continuing");
}
else
{
//What you want to do when the field is //filled
}
Hope this helps.
-James
Bucachacha@aol.com