Magento rewrite functions in validation.js

0

Hi you, today, I will guide how to rewrite functions in validation.js,
validation.js in js/prototype/validation.js, it check validation of all form in Magento website
You can use simple as below code for per form:

var dataForm = new VarienForm('form_id');

Here, I will rewrite validate function.

Step 1: Create a new file
example: custom_validation.js in skin/frontend/packed_theme/theme/js/custom_validation.js

Step 2: Add that file to layout xml
app/design/frontend/packed_theme/theme/layout/page.xml
I will add to page.xml file, you need add after validation.js

 

Step 3: Wewrite content in custom_validation.js
I add a notice “New validate function” to first line function.

 

From here, you can custom function all follow your want.

Thanks for watching!

About Author

Là một developer rất ham chơi nhưng không ham hố, không ham chơi nhưng rất thích cầm đầu...

Leave a Reply