Class Rules (namespace Nette\Forms)


List of validation & condition rules.

Object
   |
   --Rules

Implements interfaces:

IteratorAggregate (internal interface)
Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Forms/Rules.php (line 34)
Public Method Summary
Rules
Rules
addCondition (mixed $operation, [mixed $arg = NULL])
Adds a validation condition a returns new branch.
Rules
addConditionOn (IFormControl $control, mixed $operation, [mixed $arg = NULL])
Adds a validation condition on specified control a returns new branch.
Rules
addRule (mixed $operation, [string $message = NULL], [mixed $arg = NULL])
Adds a validation rule for the current control.
void
Rules
Adds a else statement.
Rules
Ends current validation condition.
ArrayIterator
Iterates over ruleset.
array
Rules
toggle (string $id, [bool $hide = TRUE])
Toggles HTML elememnt visibility.
bool
validate ([bool $onlyCheck = FALSE])
Validates against ruleset.
Methods Inherited From Object
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()
Constant Summary
string VALIDATE_PREFIX 'validate'

line 36

Variable Summary
static array $defaultMessages array( )

line 39


Method Details

line 56

__construct

public Rules __construct (IFormControl $control)

Input
IFormControl $control
Output
Rules  

line 110

addCondition

public Rules addCondition (mixed $operation, [mixed $arg = NULL])

Adds a validation condition a returns new branch.

Input
mixed $operation condition type
mixed $arg optional condition arguments
Output
Rules new branch

line 124

addConditionOn

public Rules addConditionOn (IFormControl $control, mixed $operation, [mixed $arg = NULL])

Adds a validation condition on specified control a returns new branch.

Input
IFormControl $control form control
mixed $operation condition type
mixed $arg optional condition arguments
Output
Rules new branch

line 70

addRule

public Rules addRule (mixed $operation, [string $message = NULL], [mixed $arg = NULL])

Adds a validation rule for the current control.

Input
mixed $operation rule type
string $message message to display for invalid data
mixed $arg optional rule arguments
Output
Rules provides a fluent interface

line 97

addRuleFor

public void addRuleFor ()

Output
void  
Tags
Deprecated

line 145

elseCondition

public Rules elseCondition ()

Adds a else statement.

Output
Rules else branch

line 161

endCondition

public Rules endCondition ()

Ends current validation condition.

Output
Rules parent branch

line 220

getIterator

public ArrayIterator getIterator ()

Iterates over ruleset.

Implementation of:

IteratorAggregate::getIterator
Output
ArrayIterator  

line 230

getToggles

public array getToggles ()

Output
array  

line 174

toggle

public Rules toggle (string $id, [bool $hide = TRUE])

Toggles HTML elememnt visibility.

Input
string $id element id
bool $hide hide element?
Output
Rules provides a fluent interface

line 187

validate

public bool validate ([bool $onlyCheck = FALSE])

Validates against ruleset.

Input
bool $onlyCheck stop before first error?
Output
bool is valid?