Magento Tips: How to Validate Forms In Magento

Magento Tips: How to Validate Forms In Magento

When developing the administrative part of a module, it is often necessary to limit text field for the number of characters entered. To indicate the maximum length you can use the attribute of the tag input maxlength. Also you can use the rules of the object Validator:

Example:

The rule requires mandatory input and data length from 1 to 10 characters.

If the rule is observed, the following message appears:

Text length does not satisfy specified text range.

Which does not have indication for the allowed text range, therefore, for this filed it is necessary to add a hint indicating the borders.



Post a new comment

top