|
|
Macromedia Dreamweaver
Started by Art at 11-14-2005 5:29 PM. Topic has 2 replies.
 
 
|
|
Sort Posts:
|
|
|
|
02-26-2006, 9:57 AM
|
MHunt
Joined on 02-27-2006
Posts 1
|
Re: Forms, Validation of matching fields
|
|
|
|
|
Wow, not much participation .. too bad..
Anyway, As far as validating an email address from Dreamweaver, I found that I rather write my own code..
Here's a link to validadting an email address
http://javascript.internet.com/forms/email-address-validation.html
As for comparing the email address you can do it by a simple comparision:
<SCRIPT LANGUAGE="JavaScript">
function checkEmail(form) { email1 = form.email1.value; email2 = form.email2.value;
if (email1 != email2) { alert ("\nEmail addresses are different.") return false; } else return true; }
</script>
<form onSubmit="return checkEmail(this)"> <center> <table border=0> <tr> <td>Email:</td><td><input type=text name=email1size=10></td> </tr> <tr> <td>Confirm Email:</td><td><input type=text name=email2 size=10></td> </tr> <tr> <td colspan=2 align=center><input type=submit value="Submit!"></td> </tr> </table> </form>
Hope that helps
|
|
|
|
|
Report
|
|
|
|
08-14-2007, 6:22 PM
|
Chevy B
Joined on 08-15-2007
Posts 1
|
Re: Forms, Validation of matching fields
|
|
|
|
|
Dude,
A quick solution is to create a form validation function that uses Regular Expressions to validate the format of the email address entered prior to submitting the form. Here is a little snipplet I built:
Email Validation Testing
//Author: Chevroll Bryan
//Email: chevrollbryan@yahoo.com
//Date of Creation: June 2004
//Description: This is a simple script that uses Regular Expression to validate email address from a form before it gets submitted.
function ValidateEmailAddress(txtField)
{
var str=txtField.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (!filter.test(str))
{
alert("Please input a valid email address!")
txtField.select();
txtField.focus();
return false;
}
else
{
alert('A valid email address was entered!');
return true;
}
}
Enter Email Address :
<br />
|
|
|
|
|
Report
|
|
|
|
|
Webhost4life Fo... » Development Env... » Macromedia Drea... » Forms, Validation of matching fields
|
|
|
|