I am taking over a project from a previous developer and my client needs a way for email address to actually be a valid email address (ex: formatted as someone@something.com
).
The form I'm working on is here: http://pvsquared.coop/contact-us/solar-assessment/
All I am trying to do is validate this email via Ajax (what the old developer is using) before the form progresses.
Here is a snippet of JavaScript that is being used for validation right now:
// continue to next group
$('.iphorm .next').click(function() {
var error = false;
var checked = false;
// hide errors
$('.iphorm-errors-wrap').hide();
$('html, body').animate({scrollTop:$('.page_content').position().top}, 100);
// validate text inputs
$(this).parents('.iphorm-group-wrap').find('.iphorm-element-wrap-text.iphorm-element-required input').each(function() {
if ($(this).is(':visible')) {
if ($(this).val() === '') {
$(this).parents().next('.iphorm-errors-wrap').show().html('<div class="iphorm-errors-list iphorm-clearfix"><div class="iphorm-error">This field is required</div></div>');
error = true;
}
}
});
});
Does anyone have any idea of how I could accomplish some simple email validation before the form moves on to the second step?