validate email in FrontPage form

G

Guest

How do I get FP 2002 forms to validate an email address? In other words, I
want the user to type their email address in twice, in two seperate text
boxes, and verify that they match. Thanks, DayO
 
G

Guest

If your two text boxes are named email1 and email2, as in:

<input type="text" name="email1" size="20">
<input type="text" name="email2" size="20">

then add this attribute to your <form> tag

<form onsubmit="chkEmail();" ... >

and add this script to the <head> section.

<script>
function chkEmail()
{
if (document.forms[0].email1.value == document.forms[0].email2.value)
{
document.forms[0].submit();
}
else
{
alert("E-mail addresses don't agree.");
}
}
</script>

However, this will only work if the page makes *no* use of the form field
validation built into FrontPage.

Basically, a form can only have one "onsubmit" event handler. That can be
the FrontPage event handler or a custom event handler (as described above)
but not both.

Jim Buyens
Microsoft MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Windows SharePoint Services Inside Out
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 

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