HTML_QuickForm2
[ class tree: HTML_QuickForm2 ] [ index: HTML_QuickForm2 ] [ all elements ]

Class: HTML_QuickForm2_Rule_Regex

Source Location: /HTML_QuickForm2-0.2.0/QuickForm2/Rule/Regex.php

Class Overview

HTML_QuickForm2_Rule
   |
   --HTML_QuickForm2_Rule_Regex

Validates values using regular expressions


Author(s):

Version:

  • Release: 0.2.0

Methods


Inherited Variables

Inherited Methods

Class: HTML_QuickForm2_Rule

HTML_QuickForm2_Rule::__construct()
Class constructor
HTML_QuickForm2_Rule::and_()
Adds a rule to the chain with an "and" operator
HTML_QuickForm2_Rule::checkValue()
Validates the element's value
HTML_QuickForm2_Rule::getMessage()
Returns the error message output by the rule
HTML_QuickForm2_Rule::getOptions()
Returns the rule's configuration data
HTML_QuickForm2_Rule::or_()
Adds a rule to the chain with an "or" operator
HTML_QuickForm2_Rule::setMessage()
Sets the error message output by the rule
HTML_QuickForm2_Rule::setOptions()
Sets additional configuration data for the rule
HTML_QuickForm2_Rule::setOwner()
Sets the element that will be validated by this rule
HTML_QuickForm2_Rule::validate()
Performs validation

Class Details

[line 73]
Validates values using regular expressions

The Rule needs one configuration parameter for its work: a Perl-compatible regular expression. This expression can be passed either to setOptions() or to HTML_QuickForm2_Factory::registerRule(). Regular expression registered with the Factory overrides one set for the particular Rule instance via setOptions().

The Rule can also validate file uploads, in this case the regular expression is applied to upload's 'name' field.

The Rule considers empty fields (file upload fields with UPLOAD_ERR_NO_FILE) as valid and doesn't try to test them with the regular expression.



[ Top ]


Method Detail

checkValue   [line 83]

bool checkValue( $value)

Validates the element's value
  • Return: whether element's value matches given regular expression
  • Throws: HTML_QuickForm2_Exception if regular expression is missing
  • Throws: HTML_QuickForm2_InvalidArgumentException if a bogus $registeredType was passed to constructor
  • Access: protected

Overrides HTML_QuickForm2_Rule::checkValue() (Validates the element's value)

Parameters:

   $value   — 

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:10:22 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.