Magento – Magento2 – How to execute validator on form

form-validationmagento2

I've extended the register form with some AJAX functionality and added a custom validator method decribed here. Now I want to execute the validation process after getting the result of the AJAX call.

How can I do that?

Best Answer

if You're trying to validate the form, follow the @Mage2.PRO answer. But as you mentioned in your comment that you're using a source to validate one field using ajax, then, you can use $.validator.validateElement($("#yourElement")); this'll show the error message as it'd when submitting a form.

hope it helps.

Related Topic