2

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.
Priyank
7,7627 gold badges39 silver badges70 bronze badges
asked Apr 4, 2017 at 6:00

3 Answers 3

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.'
answered Apr 4, 2017 at 6:28
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" />

answered Apr 4, 2017 at 6:13
2
  • Can someone please give a step-by-step way to implement this. Please treat me as a beginner. Thanks. Commented Apr 4, 2017 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 Commented Apr 4, 2017 at 11:42
0

You can use the below extension, it automatically adds validation based on the selected country with the country flags and automatically sets the user country by default based on their Geo IP location.

https://marketplace.magento.com/ananta-module-telephonevalidation.html

answered Feb 21, 2023 at 4:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.