I'm using this script on http://info.cfgt.com.au/diploma-of-management/sq1/
<script type="text/javascript">
jQuery(document).ready(function() {
function validateEmail(sEmail) {
var filter = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if (filter.test(sEmail)) {
return true;
}
else {
return false;
}
}
});
jQuery(document).ready(function() {
jQuery('form').submit(function() {
var sEmail = jQuery('#inf_field_Email').val();
if (validateEmail(sEmail)) {
alert('Email is valid');
e.preventDefault();
}
else {
alert('Invalid Email Address');
e.preventDefault();
}
});
});
</script>
No matter what I do, the form submits, and redirects to the default infusionsoft error page.
I can't for the life of me figure out what i've missed, and i'm at my 7th hour.
Any ideas?
Cheers,
John Detlefs
EDIT:
I'm now using the below, which kind of works:
<script>
jQuery(document).ready(function() {
jQuery('form').submit(function() {
email_address = jQuery('#inf_field_Email');
email_regex = /^[a-z0-9\._]*[a-z0-9_]@[a-z0-9][a-z0-9\-\.]*[a-z0-9]\.[a-z]{2,6}$/i;
if(!email_regex.test(email_address.val())){
alert('Please enter a valid email');
return false;
}else{
alert('All Good!');
return true;
}
});
});
</script>
The only issue that I have now is that it will accept anything@anything and doesn't seem to need the ".domain" at all.