I have an ajax form I need to call before allowing user to continue to add a product to cart. I have the form popping up but I also need to validate the contents before it submits. However the validation has changed from M1 to M2.
Essentially I need to:
- on form submit
- validate the form
- if validate then submit AJAX request
- if not valid then show validation errors.
How do I catch the form submit after the validation has happened? As if I use a regular JS event then the validation hasn't happened yet
Hope that makes sense.