...

View Full Version : validate form (some fields)



urgido
06-18-2007, 03:05 AM
how i can validate a form.

if $pass is more than 5 characters return an alert message. Same function for white spaces in $pass and $username fields.

Regards friends.

Philip M
06-18-2007, 08:47 AM
A variable name in JavaScript may only start with a letter, not a number or a $ sign.

if (password.length > 5) {
alert ("The maximum length is 5 characters);
}

If you want to delete spaces in a variable then:

password = password.replace(/\s/g, "");



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum