PDA

View Full Version : How to check for empty Password field?


CoraLover
02-12-2003, 02:30 PM
Hi, any1 knows how to validate an empty <INPUT TYPE = "Password">, a password field? I need to alert the user if the password field is empty... i've try this out.

function chk()
{
var pwd = frm.PwdField.value;

if(pwd=="")
{
alert("Please enter your password");
}
}

The above function doesn't work. It captures some funny values when it's empty... Please help me. Thanks thanks!

Danne
02-12-2003, 03:31 PM
This works for me:




function chk()
{
var pwd = frm.PwdField.value;

if(pwd=="")
{
alert("Please enter your password");
}
}



</script>

<form name="frm" method=post action="">
<input type="password" name="PwdField" onBlur="chk();">
</form>