#1
  1. No Profile Picture
    KingArtha
    Guest
    Devshed Newbie (0 - 499 posts)
    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. #2
  3. No Profile Picture
    Bucachacha
    Guest
    Devshed Newbie (0 - 499 posts)
    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

Similar Threads

  1. disable and enable ttyS0
    By rojoro5 in forum Linux Help
    Replies: 3
    Last Post: January 29th, 2004, 01:01 AM
  2. enable / disable form elements with radio buttons?
    By j0sh in forum HTML Programming
    Replies: 2
    Last Post: November 1st, 2003, 04:42 AM
  3. disable multiple submit buttons
    By bliss322 in forum HTML Programming
    Replies: 0
    Last Post: September 8th, 2003, 01:07 PM
  4. How to disable the minimize, maximize & close buttons on a form??
    By toughcoder in forum Visual Basic Programming
    Replies: 1
    Last Post: August 17th, 2003, 11:23 AM
  5. Enable button after clicking two buttons
    By sandjak in forum HTML Programming
    Replies: 2
    Last Post: May 21st, 2003, 09:45 AM

IMN logo majestic logo threadwatch logo seochat tools logo