Validate that two (e-mail) fields match in a form?

S

sunorsnow

I have a form on an html page and I used FrontPage 2003. I have two e-mail
address fields and need a way to make sure what's entered in both fields
match each other. I've found a lot of scripts for .asp, but I need one that
will work on .html. Can anyone help?
 
S

sunorsnow

Thanks - that worked for one of my pages, but on the other pages (the ones to
book travel arrangements, which are the ones I really need this on) it
doesn't work. The validation works, but then the submit doesn't - I get a
"404 not found" error when I test it. After they click on submit, it's
supposed to go to a custom confirmation page. In the other part of my form I
have hidden fields, also - would either of these (hidden fields or
confirmation page) be messing up this check e-mail script?
 
S

sunorsnow

Here's what my script is for the beginning of my form:
form id="contact" action="email-check.htm" method="get"
name="FrontPage_Form1" onsubmit="return chkvals('FrontPage_Form1')">
<form method="POST" action="--WEBBOT-SELF--"
onsubmit="location.href='_derived/nortbots.htm';return false;"
language="JavaScript" webbot-onSubmit="return
FrontPage_Form1_Validator(this)" name="FrontPage_Form1">
<!--webbot bot="SaveResults" U-File="_private/form_results.csv"
S-Format="TEXT/CSV" S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE"
S-Email-Format="TEXT/PRE" S-Email-Address="(e-mail address removed)"
B-Email-Label-Fields="TRUE" S-Builtin-Fields startspan
U-Confirmation-Url="bookingconfirmation.htm" --><input TYPE="hidden"
NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" endspan
i-checksum="43374" -->

The webbot script is so the clients are directed to a confirmation page that
shows all everything they filled in, so they have something for their
records. I'm guessing this script is what's messing things up? How do I fix
it so that I can have the confirmation page AND the e-mail check?
 
R

Ronx

Did you read the last two paragraphs in the page (
http://www.rxs-enterprises.org/tests/email-check.htm )where it says:

Do not use FrontPage validation

and

Change the form properties to "Send to email" or "Send to File", and set
up the confirmation page.

If you want to use FrontPage validation there is a lot more to be done -

1) Change the form properties as above

2) the email check script must be added to the validation script that
FrontPage produces - this can be done in NotePad, it cannot be done in
FrontPage.

3) The form name must be changed in two places as mentioned on the page

4) All FrontPage validation webbots must be removed from the form -
again in NotePad so FP doesn't redo changes 1 and 2.

Your form has 2 form tags where there should only be one - though the
first appears to be broken (lacking an opening "<"). The second tag
should work provided you publish the form using HTTP to a server running
the FP extensions, but it will not check the email fields.

The one and only form tag (as seen in FrontPage code view in a disc
based web) should be:

<form id="contact" action="--WEBBOT-SELF--" method="POST" name="contact"
onsubmit="return chkvals('contact')">

And the rest of the form:

<!--webbot bot="SaveResults"
U-File="../_private/form_results2.txt" S-Format="TEXT/PRE"
S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE" S-Builtin-Fields
U-Confirmation-Url="Default.asp" -->
<p>Email <input class="inp" name="email1"
onchange="compFields('contact')" type="text" /></p>
<p>Retype Email <input class="inp" name="email2"
onchange="compFields('contact')" type="text" /></p>
<p style="padding-left:3em;"><input class="button" name="Button1"
type="submit" value="Submit" /></p>
</form>

(I have not set an email address, and this form only has 2 fields.)
Note the total lack of FP validation.

In the browser (as produced by Preview in Browser) this becomes:

<form id="contact" action="../_derived/nortbots.htm" method="POST"
name="contact" onsubmit="location.href='../_derived/nortbots.htm';return
false;" webbot-action="--WEBBOT-SELF--" webbot-onSubmit="return
chkvals('contact')">
<!--webbot bot="SaveResults"
U-File="../_private/form_results2.txt" S-Format="TEXT/PRE"
S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE" S-Builtin-Fields
U-Confirmation-Url="Default.asp" startspan --><input TYPE="hidden"
NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults"
i-checksum="43374" endspan -->
<p>Email <input class="inp" name="email1"
onchange="compFields('contact')" type="text" /></p>
<p>Retype Email <input class="inp" name="email2"
onchange="compFields('contact')" type="text" /></p>
<p style="padding-left:3em;"><input class="button" name="Button1"
type="submit" value="Submit" /></p>
</form>


Finally after HTTP publishing to a server (Windows server in this case -
Unix servers will be slightly different) this changes again to: (View
Source in Browser)


<form id="contact"
action="../_vti_bin/shtml.dll/tests/email-check.htm" method="POST"
name="contact" onSubmit="return chkvals('contact')"
webbot-action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults"
U-File="../_private/form_results2.txt" S-Format="TEXT/PRE"
S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE" S-Builtin-Fields
U-Confirmation-Url="Default.asp" startspan --><input TYPE="hidden"
NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" endspan
i-checksum="43374" -->
<p>Email <input class="inp" name="email1"
onchange="compFields('contact')" type="text" /></p>
<p>Retype Email <input class="inp" name="email2"
onchange="compFields('contact')" type="text" /></p>
<p style="padding-left:3em;"><input class="button" name="Button1"
type="submit" value="Submit" /></p>
</form>


You can see the published version of this at
http://www.rxs-enterprises.org/tests/email-check2.htm
--
Ron Symonds - Microsoft MVP (FrontPage)
Reply only to group - emails will be deleted unread.

http://www.rxs-enterprises.org/fp
 
S

sunorsnow

Thanks - I actually had to create the form in a completely separate/blank
page, tested it, then copied and pasted that code over my old code on the
page I want to use it on. This finally worked. There must have been
something with my old form that was preventing this from working, so starting
from scratch fixed it. Now it will just take a lot of work to get this set
for all of my pages!
 

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