Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

verification of email address (comparison)

Status
Not open for further replies.

ssnapier

Technical User
Feb 17, 2001
67
0
0
US
I have a form that requires the user to input his/ her email address. I want to have them enter it twice, and have the two address compared and verified before submission. Can FrontPage do this using it's validation feature somehow? If so how?

The form is being submitted using CFMAIL, but the validation is being done using FrontPage's validation, and that is the last thing I need to do before it is ready to go!
 
Hi there

To achieve this I would use some simple JavaScript form validation.

Place this code within the
Code:
<head>
tags. You will need to alter some of the values to match your form name and input box names.

Code:
<script language=&quot;Javascript&quot;>
function validate(form_name) {

// --- Ensure the two email address fields match ---
if (form_name.email_address_1.value!= form_name.email_address_2.value)
	{
		alert(&quot;The email address fields do not match. Please try again.&quot;)
		form_name.email_address_1.value = &quot;&quot;
		form_name.email_address_2.value = &quot;&quot;
		form_name.email_address_1.focus();
		return false;
	}

    return true;
}
</script>

Then within your
Code:
<form>
tag place this at the end...

Code:
onSubmit=&quot;return validate(form_name)&quot;

Hope this helps
Craig
 
actually when I went to try this, I ran into a problem...

my form tag already has an onSubmit action running for the front page form validator, so how do I add a second one? Is it possible to make the frontpage validator do this since it is already working for me here?
 
Try this - not sure if it'll work as I've not tested it...

Code:
onSubmit=&quot;FrontPageValidation; return validate(form_name)&quot;

... after the FrontPage validation add a semi-colon then the return validate(form_name) code.

Regards,
Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top