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

Class: HTML_QuickForm2_Rule_Each

Source Location: /HTML_QuickForm2-2.1.0/HTML/QuickForm2/Rule/Each.php

Class Overview

HTML_QuickForm2_Rule
   |
   --HTML_QuickForm2_Rule_Each

Validates all elements in a Container using a template Rule


Author(s):

Version:

  • Release: 2.1.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::getConfig()
Returns the rule's configuration data
HTML_QuickForm2_Rule::getJavascript()
Returns the client-side representation of the Rule
HTML_QuickForm2_Rule::getJavascriptCallback()
Returns the client-side validation callback
HTML_QuickForm2_Rule::getJavascriptTriggers()
Returns IDs of form fields that should trigger "live" Javascript validation
HTML_QuickForm2_Rule::getMessage()
Returns the error message output by the rule
HTML_QuickForm2_Rule::getOwnJavascriptTriggers()
Returns IDs of form fields that should trigger "live" Javascript validation
HTML_QuickForm2_Rule::mergeConfig()
Merges local configuration with that provided for registerRule()
HTML_QuickForm2_Rule::or_()
Adds a rule to the chain with an "or" operator
HTML_QuickForm2_Rule::setConfig()
Sets configuration data for the rule
HTML_QuickForm2_Rule::setMessage()
Sets the error message output by the rule
HTML_QuickForm2_Rule::setOwner()
Sets the element that will be validated by this rule
HTML_QuickForm2_Rule::setOwnerError()
Sets the error message on the owner element
HTML_QuickForm2_Rule::validate()
Performs validation
HTML_QuickForm2_Rule::validateOwner()
Validates the owner element

Class Details

[line 52]
Validates all elements in a Container using a template Rule

This Rule needs one configuration parameter for its work: the template Rule to use for actual validation. It can be passed either to the Rule constructor as local configuration or to HTML_QuickForm2_Factory::registerRule() as global one. As usual, global configuration overrides local.

The container will be considered valid if all its elements are valid according to a template Rule.

  1.  $group->addRule('each''The fields should contain only letters',
  2.                  $group->createRule('regex''/^[a-z]+$/i'));



[ Top ]


Method Detail

getJavascriptCallback   [line 78]

string getJavascriptCallback( )

Builds the callbacks for the owner's children using the template Rule
  • Return: Javascript function calling all children's callbacks
  • Access: protected

Overrides HTML_QuickForm2_Rule::getJavascriptCallback() (Returns the client-side validation callback)
[ Top ]

setConfig   [line 103]

HTML_QuickForm2_Rule setConfig( HTML_QuickForm2_Rule $config)

Sets the template Rule to use for actual validation

We do not allow using Required rules here, they are able to validate containers themselves without the help of Each rule.

  • Throws: HTML_QuickForm2_InvalidArgumentException if $config is either not an instance of Rule or is an instance of Rule_Required
  • Access: public

Overrides HTML_QuickForm2_Rule::setConfig() (Sets configuration data for the rule)

Parameters:

HTML_QuickForm2_Rule   $config   —  Template Rule

[ Top ]

setOwner   [line 126]

void setOwner( HTML_QuickForm2_Node $owner)

Sets the element that will be validated by this rule
  • Throws: HTML_QuickForm2_InvalidArgumentException if trying to use this Rule on something that isn't a Container
  • Access: public

Overrides HTML_QuickForm2_Rule::setOwner() (Sets the element that will be validated by this rule)

Parameters:

HTML_QuickForm2_Node   $owner   —  Container to validate

[ Top ]

validateOwner   [line 59]

bool validateOwner( )

Validates the owner's children using the template Rule
  • Return: Whether all children are valid according to a template Rule
  • Access: protected

Overrides HTML_QuickForm2_Rule::validateOwner() (Validates the owner element)
[ Top ]


Documentation generated on Wed, 10 Apr 2019 08:56:09 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.