Magento – How to add validation for telephone number in magento customer registration form

customermagento-1.9validation

I'm very new in magento and will appreciate if someone can give me a step-by -step procedure to 2 validations in the customer registration form in Magento 1.9.

  1. The size of telephone number field should be 10 and numeric
  2. Zipcode should not accept alphabets.

Best Answer

You can simply add validate class for validation in magento 1.

For Phone Number Validation

'validate-phoneStrict'          => 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.'
'validate-phoneLax'             => 'Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.'
'validate-fax'                  => 'Please enter a valid fax number. For example (123) 456-7890 or 123-456-7890.'

For Zip Code Validation

'validate-zip'                  => 'Please enter a valid zip code. For example 90602 or 90602-1234.'
'validate-zip-international'    => 'Please enter a valid zip code.'
Related Topic