0

I want to remove default validation from login and registration form and add my custom validation in magento2.2.5?

1 Answer 1

0

Remove validation from Login page: Copy login.phtml from below path:

vendor/magento/module-customer/view/frontend/templates/form/login.phtml

to your theme location:

app/design/frontend/[Vendor]/[theme]/Magento_Customer/templates/form/login.phtml

and remove the below code from the form: data-mage-init='{"validation":{}}'

Also remove the data-validate from the every fields of that form.

Now you can add your custom validation according to your requirement.

Remove validation from Registration page: Copy register.phtml from below path:

vendor/magento/module-customer/view/frontend/templates/form/register.phtml

to your theme location:

app/design/frontend/[Vendor]/[theme]/Magento_Customer/templates/form/register.phtml

and remove the below code from the form: data-mage-init='{"validation":{}}'

Also remove the data-validate from the every fields of that form.

Now you can add your custom validation according to your requirement.

8
  • Not working. I have already tried this.
    – Amy
    Apr 26, 2019 at 14:11
  • I have checked it in local system and its working fine for me. Can you check if some module extended that file. Apr 26, 2019 at 14:39
  • Now it is working. but after submitting my login form, the form is just being loaded. It is not logging in.
    – Amy
    Apr 27, 2019 at 5:40
  • It is showing error message as "A login and a password are required."
    – Amy
    Apr 27, 2019 at 6:04
  • Yes for this you need remove server side validation as well. Apr 27, 2019 at 8:49

Your Answer

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

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