Hi everyone, i have a contact form that i decided to use ajax to submit, i'm validating the data on the server side and i would like to use html5 validation to validate the form on the client side (e.g. <input name="email" type="email" required="required" id="Email" />), however in my ajax JavaScript to initiate the submission i'm using an onclick event on the submit button, however, the html5 validation is initialed on this event as well, so that the submission and validation happens in parallel, thus rendering the validation ineffective. So basically what i want is a way of initiating my ajax submission to occur after the html5 validation.
Use setTimeout and return false to prevent the form from being submitted.
With that setTimeout, set it to something like 100ms so that your delayed function can check the form and then submit it, if appropriate.
Bookmarks