I want to change the rules in all magento forms, to accept just English characters. So any non-english character in magento form should not be accepted. any suggestion how I could do it?


I Added this code inside validation.js located in js\prototype

    Validation.add('validate-english-alphanum-with-spaces', 'Please use only english letters', function(v) {
             return Validation.get('IsEmpty').test(v) || /^[a-zA-Z0-9 ']+$/.test(v)

Then edit the forms css class in frontend\yourtheme\template\persistent\checkout\onepage\billing.phtml add validate-english-alphanum-with-spaces to the class

Note: This will change the validation in the client side, you have to change Zend validation rules to change the validation in the server side.

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.