2

Need to check whether user has 18 years old (that's simply to do in javascript) then display error/success message and pass further.

How to add validation for 'date of birth' field in customer registration form?

Which js I should extend for this purpose?

1
0

You should extend this file with your own validation rule.

'/lib/web/mage/validation.js'

After you added your own validation rule just add the following to your input field

 data-validate="{'Your-validation-name':true}"

example:

data-validate="{'custom-age-validation':true}"

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.