Welcome to Webhost4life Forum Sign in | Join | Faq

Macromedia Dreamweaver

Started by Art at 11-14-2005 5:29 PM. Topic has 2 replies.

Print Search
Sort Posts:    
   11-14-2005, 5:29 PM
Art is not online. Last active: 11/15/2005 9:22:59 AM Art

Top 500 Posts
Joined on 11-15-2005
Posts 1
Forms, Validation of matching fields
Reply Quote

I have created a form and want to verify that the user has correctly enter there email address twice, once in the email field and once in the verify email field. As good as Dreamweaver MX 2004 is, the 'Behaviors' do not offer this 'OnSubmit' in the Validate dialog window. Is there an easy way to complete this task?


   Report 
   02-26-2006, 9:57 AM
MHunt is not online. Last active: 2/27/2006 1:47:30 AM MHunt

Top 500 Posts
Joined on 02-27-2006
Posts 1
Re: Forms, Validation of matching fields
Reply Quote
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 is not online. Last active: 8/15/2007 9:20:07 AM Chevy B

Top 500 Posts
Joined on 08-15-2007
Posts 1
Re: Forms, Validation of matching fields
Reply Quote
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... » Re: Forms, Validation of matching fields

Powered by Community Server, by Telligent Systems