bluesfc2
07-06-2006, 07:04 AM
Hi:)
I want the user to enter their password twice to avoid errors. Below is an extract of my current code.
I have now put two inputs for their email address. How do I change my code to check if both are the same please.
<input TYPE="text" NAME="email">
<input TYPE="text" NAME="email2">
if (!validateInputBox(document.theForm.nickname.value))
{ isValid = false; alert(' Please fill in your name.'); }
if (!validateInputBox(document.theForm.vpassword.value))
{ isValid = false; alert(' Please fill in the password of your message.'); }
if (!validateEmail(document.theForm.email.value))
{ isValid = false; alert(' Please fill in a correct email address.'); }
if (isValid)
alert ("Thank you. Your form is being sent.");
return isValid;
}
function validateInputBox(text) {
return (text.length > 0);
}
function validateEmail(emailAddress) {
var match = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/.test(emailAddress);
return match;
}
cheers Peter
I want the user to enter their password twice to avoid errors. Below is an extract of my current code.
I have now put two inputs for their email address. How do I change my code to check if both are the same please.
<input TYPE="text" NAME="email">
<input TYPE="text" NAME="email2">
if (!validateInputBox(document.theForm.nickname.value))
{ isValid = false; alert(' Please fill in your name.'); }
if (!validateInputBox(document.theForm.vpassword.value))
{ isValid = false; alert(' Please fill in the password of your message.'); }
if (!validateEmail(document.theForm.email.value))
{ isValid = false; alert(' Please fill in a correct email address.'); }
if (isValid)
alert ("Thank you. Your form is being sent.");
return isValid;
}
function validateInputBox(text) {
return (text.length > 0);
}
function validateEmail(emailAddress) {
var match = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/.test(emailAddress);
return match;
}
cheers Peter