1

How could I validate only integer numbers on input text Magento?

The file I need to change in text.phtml and I know all of the validation terms on prototype, so I just need to know how to insert this on the code.

  • You can use isNaN to validate if the entered input is number of not. You can wrap it up in function and call it using some class by jQuery or javascript – Dexter Mar 5 '15 at 3:51
4

Add a class called "validate-digits" to your input type text line in the form.bascially it will look like

<input type="text" class="(your_other_classes) validate-digits" />

for more validation classes you can refer Form Validation in Magento

Note : 'validate-digits' => 'Please use numbers only in this field. Please avoid spaces or other characters such as dots or commas.'

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.