I've got a form that I'm using to capture payment info. I am capturing the user's click on the Submit button, preventing the default submission, then doing some work with the data in the form to submit the payment to a payment gateway's API. I need to wait to get a response from that API before then calling the standard submit on the form.
The ONE piece of this puzzle that I'm missing is how to trigger form validation from my jQuery to determine whether all the fields are valid BEFORE submitting to the payment API. I have been searching for a method to do so.
Has anyone done something similar, or knows of a function I can call to validate the form? I've been searching extensively and have not stumbled on the answer yet with the right keywords, or the answer just isn't out there for me to find yet!
Any help that will point me in the right direction is appreciated!
Do you have jQuery form validation enabled or are you validating on the server? If you’re validating on the server, you shouldn’t have to call anything. Validation should still occur on final submit.
The form is set to validate with Javascript, which is what I want, I just want to call a function or something with jQuery to initiate it when I need it. Does that make sense?
<p>I never had a reason to research how Formidable’s jQuery validation works, but it has to bound to field events when they fire. There are only so many field events that can be used like blur or change. I would test a field by triggering one of those events in the console.</p>
@Bret Hummel I have the EXACT same scenario and issue, need to validate a few things before I can send the payment (with the additional data) have you found a way to trigger the form validation via JS? I can confidently guess you are trying to integrate with stripe lol. Thanks so much
Please login or Register to submit your answer