Class Rules (namespace Nette\Forms)


List of validation & condition rules.

Object
   |
   --Rules

Implements interfaces:

IteratorAggregate (internal interface)
Copyright: Copyright (c) 2004, 2010 David Grudl
Located: in /Forms/Rules.php (line 21)
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.
Rules
Adds a else statement.
Rules
Ends current validation condition.
static void
formatMessage ($rule, $withValue)
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()
Variable Summary
static array $defaultMessages array( )

line 27


Method Details

line 44

__construct

public Rules __construct (IFormControl $control)

Input
IFormControl $control
Output
Rules  

line 88

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 102

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 58

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 123

elseCondition

public Rules elseCondition ()

Adds a else statement.

Output
Rules else branch

line 139

endCondition

public Rules endCondition ()

Ends current validation condition.

Output
Rules parent branch

line 247

formatMessage

public static void formatMessage ($rule, $withValue)

Input
$rule
$withValue
Output
void  

line 198

getIterator

public ArrayIterator getIterator ()

Iterates over ruleset.

Implementation of:

IteratorAggregate::getIterator
Output
ArrayIterator  

line 208

getToggles

public array getToggles ()

Output
array  

line 152

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 165

validate

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

Validates against ruleset.

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