|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. ------------------ |
|
#2
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Web Design > HTML Programming > Enable Disable Buttons !! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|