1

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?

2 Answers 2

5

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.

2

The forms are automatically validated before its submission.
You can also run a form validation manually.
You should load the mage/validation library and then call $(form).validation().

2
  • 1
    Yes I know. I want to execute the validation for only the AJAX Input field, if the result is false. In Magento 1 I could use Validation.validate($(FIELD_NAME))
    – ClassMP
    Commented Feb 2, 2016 at 12:27
  • @ClassMP please mention that in your question.
    – R T
    Commented Jun 6, 2016 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.