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

Class: HTML_QuickForm2_Rule_Nonempty

Source Location: /HTML_QuickForm2-2.0.0/HTML/QuickForm2/Rule/Nonempty.php

Class Overview

HTML_QuickForm2_Rule
   |
   --HTML_QuickForm2_Rule_Nonempty

Rule checking that the field is not empty


Author(s):

Version:

  • Release: 2.0.0

Methods


Child classes:

HTML_QuickForm2_Rule_Required
Rule for required elements

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 77]
Rule checking that the field is not empty

Handles simple form fields, file uploads and Containers.

When validating <select multiple> fields and Containers it may use an optional configuration parameter for minimum number of nonempty values, defaulting to 1. 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.

  1.  // Required rule is 'nonempty' with a bit of special handling
  2.  $login->addRule('required''Please provide your login');
  3.  $multiSelect->addRule('required''Please select at least two options'2);



[ Top ]


Method Detail

getJavascriptCallback   [line 128]

void getJavascriptCallback( )

  • Access: protected

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

setConfig   [line 115]

HTML_QuickForm2_Rule setConfig( int $config)

Sets minimum number of nonempty values

This is useful for multiple selects and Containers, will be ignored for all other elements. Defaults to 1, thus multiple select will be considered not empty if at least one option is selected, Container will be considered not empty if at least one contained element is not empty.

  • Throws: HTML_QuickForm2_InvalidArgumentException if a bogus limit was provided
  • Access: public

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

Parameters:

int   $config     Minimum number of nonempty values

[ Top ]

validateOwner   [line 79]

void validateOwner( )

  • Access: protected

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


Documentation generated on Tue, 26 Jun 2012 15:30:24 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.