Confirm Email Address in Form (URGENT)

G

Guest

I posted a message earlier that read "I want people to re-type their email
address to confirm their email address in a form I have. However, if they
accidentally type a different address in, they are not prompted of the error
on "submit". How do I validate or set the field properties to require the
same address in the field as in the original email field on "submit"?

The response I got was "You compare the two fields.

<input type="submit" onclick="if (this.field1.value == this.field2.value) {
return true; } else { alert('Email addresses do not
match!'); this.field1.focus(); return false; } " value="Submit" >

I tried pasting the code in but it isn't working for me.

My one field is "email_address" and the other field is "confirm_email".

What changes do I need to make to the above code to get it to work?

I tried "<input type="submit" onclick="if (this.email_address.value ==
this.confirm_email.value) { return true; } else { alert('Email addresses do
not
match!'); this.field1.focus(); return false; } " value="Submit" >, but it
didn't work.

I am doing a fund raiser tomorrow for charity and really need to get this
done as soon as possible. Please help!!!
 
T

Thomas A. Rowe

Try the following

Change field1 to: email_address

and field2 to: confirm_email

You do understand that doing doesn't indicate that the user has entered a valid email address.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
G

Guest

as was stated, I tried that, but it is not working. Does anybody know what
changes I need to make to the code. If you could just type the entire code
so that I could copy and paste would be better. Thanks
 
A

Andrew Murray

change field1.value to "email.value" and "value2.value" to
"confirm_email.value".
I've also posted another script that does the same thing - it was designed
as the type of thing "Enter password and Enter it again", but it's adaptable
to email addresses; and probably a little easier to understand.

Ignore the bit about the Name field; I used this script in a registration
form; was just mucking around with trying to see if I could write a
validation where a field is left empty (rather than relying on the FP
validation); it's not relvant to your post,so you can delete that part of
the script.

Delete this bit:
}
if (full_name = "") {
alert ("\n No value was entered in the NAME field. Please enter a value")
return false;
}
else return true;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top