1

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.
2

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.'
1

Follow this Link:-

http://inchoo.net/magento/out-of-the-box-form-validation-in-magento/

OR

you can use these classes to validate the Telephone number:-

'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.'

EX:- <input class="required validate-phoneStrict" id="field1" name="field1" />

  • Can someone please give a step-by-step way to implement this. Please treat me as a beginner. Thanks. – neha_iamforever Apr 4 '17 at 6:54
  • Just go to the phtml of the Registration page app/design/frontend/base/default/template/persistent/customer/form/register.phtml find the field to which your field is generated and the above said class – B Karthik Kumar Apr 4 '17 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.