Validator

The Validator is a tool that can be used to validate user input. For this task, several static methods are available, that return true in case of successful validation and false otherwise.

The class myValidator formed the basis of the validation of the form controls up to release 1.10. Since 1.11, specialized form validators are included. To get an overview of the shipped form validators, please refer to Forms.

In order to use the Validator, first include it using

PHP code
import('tools::validator','Validator');
Afterwards, the listed methods can be used:

  • validateText():
    Checks whether the given string contains more than three characters.
  • validateEMail():
    Validates if the given string is a valid e-mail address.
  • validateTelefon():
    Validates if the given string is a valid phone number.
  • validateFax:
    Validates if the given string is a valid fax number.
  • validateNumber():
    Checks whether the given string is a number.
  • validateFolder():
    Validates if the given string is suitable for naming a folder.
  • validateRegExp():
    Checks whether the given string matches the given regular expression.
Details on the listed methods can be taken from the API documentation.

Comments

Do you want to add a comment to the article above, or do you want to post additional hints? So please click here. Comments already posted can be found below.
There are no comments belonging to this article.