I have a MailChimp sign up form on a ASPX hosted site - the traditional form action does not work, so i've had to make the form submit via jQuery as per code below.
Issue is... the validation is ignored now and the form submits even if the required fields are left empty... The HTML5 validation throws an error - but jQuery then submits the form and moves the user away from the form...
How can I force jQuery to wait for the HTML5 validation to be confirmed as correct before submitting?
Form submit button code is:
<input id="mc-embedded-subscribe" name="subscribe" type="submit" value="Subscribe" class="button" onClick=this.form.action='https://accountname.us2.list-manage.com/subscribe/post?u=abc&id=123';this.form.submit(); /></div>
Field that needs to be completed is:
<input id="mce-EMAIL" name="EMAIL" type="email" value="" class="required email" required />
Please note to make the form work on ASPX - I've had to remove all "form" tag elements - so not sure the traditional jQuery validate approach will work... See > https://mailchimp.com/help/troubleshooting-the-embedded-signup-form/#The_embedded_form_code_doesn%27t_work_with_ASP.NET.
Form code is:
<form id="formID">
<div class="mc-field-group">
<label for="mce-EMAIL">Email Address <span class="asterisk">*</span> </label> <input class="required email" id="mce-EMAIL" name="EMAIL" required="" type="email" value="" required /></div>
<div class="clear SubmitBtnWrapper">
<input class="button" id="mc-embedded-subscribe" name="subscribe" onclick="this.form.action='https://brandname.us2.list-manage.com/subscribe/post?u=123&id=abc';this.form.submit();" type="submit" value="Subscribe" /></div>
</form>