[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Text vs. password input types



Hello all,

Is anybody aware of JavaScript differences between input types
"text" and "password"?  I'm trying to do some basic checking
of forms data before calling the cgi script, and for text it
works, but for password fields it doesn't.

Checking for a null string with 

 if (Ctrl.value == "") 

           and

 if (Ctrl.value.length == 0) 

both work with type text, but fail with type password.

Some code is below, thanks for any ideas.


//check password for null
//doesn't work
function TestPassword(form) {
    Ctrl = form.password;
       if (Ctrl.value == "") 
         alert ( "Please enter a password")
     else
        alert("Password OK");
          
}

//check text for null
//same code, this works
function TestText(form) {
    Ctrl = form.text;
       if (Ctrl.value == "") 
         alert ( "Please enter some text")
     else
        alert("Text OK");
}          



----------------------------------------------
Joel Weeks
Webmaster
Cooper & Chyan Technology, Inc.

email: joelw@cctech.com
web  : www.cctech.com
phone: (408) 342-5631
snail: 1601 South De Anza Blvd.
       Cupertino, CA 95014
	

--------------------------------------------------------------------
This message came from the mailing list javascript. For help using the
mailing list software, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.