0

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?

Keenan Payne
  • 796
  • 2
  • 15
  • 32
  • 1
    If all you want to validate is that the email follows the correct format, you don't need ajax for that. – Kevin B Feb 10 '14 at 22:37
  • Well I'm not very good at JavaScript but how would you go about implementing that solution to the link that you posted? – Keenan Payne Feb 10 '14 at 22:40

0 Answers0