here is a code : http://pastebin.com/qCNGSKRn to display telephone filed to enter telephone number.

i want to restrict above field to accept only numbers and also maximum 10 numbers to be entered. all special charactars and special symbols and white spaces should not allowed.

that field should not accept more than 10 digits.

please help me to find solution.


In your class attribute add following class names

validate-length maximum-length-10 minimum-length-10 validate-digits

which will look like

class="input-text validate-length maximum-length-10 minimum-length-10 validate-digits <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>"

you can go through this link http://inchoo.net/magento/out-of-the-box-form-validation-in-magento/ for more details about validation in magento

| improve this answer | |
  • 1
    Which files contain the code for street address lines in checkout? – Sparc Aug 10 '16 at 11:42

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.