Validator names, naming conventions

When naming validators, we recommend that you use these naming conventions:

  • Use component names that contain only alphanumeric characters and the underscore (_) character.. Alphanumeric characters include the letters a-z, either upper case or lower case, and the numerals 0-9.
  • Validator names should be in camel case and should contain no blanks in the name.
  • Generally, the validator name should include the name of the property it is validating. In simple cases, the name can be the same as the property. The validator name should be descriptive enough to distinguish it from other validators.

    For example, if you are naming a validator for a property that will probably have other validators, extend the name, possibly by including the names of the other properties used in the validation.

  • Indicate validators that include properties or variables with an underscore (_), followed by the name of the property or variable; for example, MyValidator_MyProperty.
  • Validators with parameters must include percent (%) symbols, followed by integers (starting with 1), one for each substitution parameter being passed. Multiple parameters must be comma-delimited with no spaces. These must be contained within parentheses.

    For example, the name of a validator that has two parameters to pass would end with (%1,%2).