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?

4

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.

| improve this answer | |
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().

| improve this answer | |
  • 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 Feb 2 '16 at 12:27
  • @ClassMP please mention that in your question. – R T Jun 6 '16 at 7:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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