I am using the following code on a form to use the validation.js library to validate the form. One of the validation files uses ./rules.js to extend the rules used within the validator which I have managed to overwrite. However {"validation":{}} is not the file that uses it. Can some body please show me?
I have not set a requirejs config in the module that I am doing this from.
I want to add a basic rule that comes back true or false every time just to start from somewhere.
data-mage-init='{"validation": {}}
Best Answer
It's hard to answer your question without creating an example. So I suppose that you need to add your custom validation rule into your custom payment method in Magento 2.
Then, your method render js will look like this:
Now, in your custom payment method template file:
As you see, whenever the value attribute of
#hidden-input-one
is empty,#input-one
will not pass the validation.CONCLUSION
mage/validation
is the key.