How does form field validation occur on a Magento Checkout page

1.7k views Asked by At

I am unable to figure out what is triggering the form validation on the Magento Checkout page. Magento 2.4, PHP 7.4

On Selecting the radio buttons for the shipping methods it automatically shows a required field validation on the remaining input fields.

The following picture shows the required field validation that occurs on the input fields on toggling between radio buttons

I have been searching in the code for the source of the validation. As of now I have found a file 'default-validator.js' which could be the one that is being triggered but I am unable to find any references to that file so not sure from where the validation is being triggered. I did think it could be the default validation but I checked that all the involved form tags have novalidate on which means default validation is off.

The following image shows the content of defaut-validator.js

1

There are 1 answers

2
Rob Hannaford On BEST ANSWER

Try having a look in this layout file, there's quite a few examples of where it is used. Hopefully this will give you the starting point you need, just do a search for validation:

vendor\magento\module-checkout\view\frontend\layout\checkout_index_index.xml