Using the form validator with AJAX |
I am submitting a form to my controller with AJAX, not via the action/method of the form itself. How do I use the validator with this method, since the data is coming in as a post request?
If all elements are wrapped in form, you can use like this :
if(!$('#form-id')[0].checkValidity()){ document.querySelector('#form-id').reportValidity(); return false; }
(01-25-2021, 09:15 PM)iampuping Wrote: I am submitting a form to my controller with AJAX, not via the action/method of the form itself. How do I use the validator with this method, since the data is coming in as a post request? In your controller do something like this: PHP Code: $validationRules = array( |
Welcome Guest, Not a member yet? Register Sign In |