Confirm Email Address in Form (UNGENT, URGENT, URGENT)

M

Michelle

As stated in my last post, I already tried that, but it doesn't work. Can
someone pleasy type the code so I can cut and paste it, as I have spent an
entire day working on this detail to no avail and am way behind schedule?

Again, I have a form asking for considerable information including email
address with confirmation. One field is "email_address" and the other is
"confirm_email". I tried pasting in the code:

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

That doesn't work, as it accepts both the right and wrong email addresses
without prompting on the error. I also tried the Password Javascript and
that doesn't work either. Can someone please help me with the right code to
confirm email address in forms?
 
D

Dan L

Try

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

Andrew Murray

Michelle,

The script below would be perfect for your needs.
It says "Password Verifier" (which was the oringal intent/use of the script)
but it will work just as well for email; all it does is compare two fields
and gives an "alert" if they don't match.

I've changed the variables and field names to suit your purpose. All you do
is copy and paste to the correct place in your code (Frontpage code view).
To be sure the copy/paste works, copy this from the newsgroup message into
Notepad; then pasted to your code.

You just need to paste the form fields to the correct place in your form in
the <body>, and paste the script to the <head> of your code.

Add the onSubmit="return checkPw(this)" bit to your opening form tag

<!-- TWO STEPS TO INSTALL PASSWORD VERIFIER:

1. Copy the coding into the HEAD of your HTML document
2. Add the last code into the BODY of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Carey Walker ([email protected]) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function checkPw(form) {
email1 = form.email_address.value;
email2 = form.confirm_email.value;


if (email1 != email2) {
alert ("\nYou did not enter the same email address twice. Please try
again.")
return false;
}
else return true;
}

// End -->
</script>

<!-- STEP TWO: Copy this code into the BODY of your HTML document -->

<form onSubmit="return checkPw(this)">
<center>
<table border=0>
<tr>
<td>Password:</td><td><input type="text" name="email_address"
size="10"></td>
</tr>
<tr>
<td>Re-enter:</td><td><input type="text" name="confirm_email"
size="10"></td>
</tr>
<tr>
<td colspan=2 align=center><input type="submit" value="Submit!"></td>
</tr>
</table>
</form>

<p><center>
<font face="arial, helvetica" size="-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 1.13 KB -->


Hope this works and ends up being what you need.
 
M

Michelle

Thank you dear for your hard work, but it still doesn't work. If I typed 2
separate email addresses and click "submit", it still accepts the wrong email
address.
 
B

Bob Lehmann

It would be very helpful if you put your page up on the Web, so someone
could look at the whole picture. And a more complete description of "doesn't
work" would also be helpful.

Anyway, I don't think you can cancel a form submit from the onclick of a
submit button.

So, 2 things....
1. Move the script to the onsubmit event of the form tag.

2. Make sure the script part is all on one line. You can get some funkiness
sometimes in scripts with linebreaks if you're not careful.

You will, of course have to supply the correct action. And, if you're using
FP automagical validation, this won't work without tweakage - See my first
remark.
<form method=post action="" onsubmit="if (this.email_address.value ==
this.confirm_email.value) { return true; } else { alert('Email addresses do
not match!'); this.sponsor_confirm_email.focus(); return false; }">

Bob Lehmann
 
B

Bob Lehmann

Sorry, there's a typo....
I left sponsor_confirm_email in one place. Change it to confirm_email.

<form method=post action="" onsubmit="if (this.email_address.value ==
this.confirm_email.value) { return true; } else { alert('Email addresses do
not match!'); this.confirm_email.focus(); return false; }">

Bob Lehmann
 
S

Stefan B Rusynko

PS
and if you are using any other FP form validation the script will be removed when you save the page

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| It would be very helpful if you put your page up on the Web, so someone
| could look at the whole picture. And a more complete description of "doesn't
| work" would also be helpful.
|
| Anyway, I don't think you can cancel a form submit from the onclick of a
| submit button.
|
| So, 2 things....
| 1. Move the script to the onsubmit event of the form tag.
|
| 2. Make sure the script part is all on one line. You can get some funkiness
| sometimes in scripts with linebreaks if you're not careful.
|
| You will, of course have to supply the correct action. And, if you're using
| FP automagical validation, this won't work without tweakage - See my first
| remark.
| <form method=post action="" onsubmit="if (this.email_address.value ==
| this.confirm_email.value) { return true; } else { alert('Email addresses do
| not match!'); this.sponsor_confirm_email.focus(); return false; }">
|
| Bob Lehmann
|
|
| | > As stated in my last post, I already tried that, but it doesn't work. Can
| > someone pleasy type the code so I can cut and paste it, as I have spent an
| > entire day working on this detail to no avail and am way behind schedule?
| >
| > Again, I have a form asking for considerable information including email
| > address with confirmation. One field is "email_address" and the other is
| > "confirm_email". I tried pasting in the code:
| >
| > "<input type="submit" onclick="if (sponsor_email.value ==
| > sponsor_confirm_email.value) { return true; } else { alert('Email
| addresses
| > do not match!'); sponsor_confirm_email.focus(); return false; } "
| > value="Submit" >"
| >
| > That doesn't work, as it accepts both the right and wrong email addresses
| > without prompting on the error. I also tried the Password Javascript and
| > that doesn't work either. Can someone please help me with the right code
| to
| > confirm email address in forms?
| > --
| > Thanks a million. Michelle
|
|
 

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