namespace Nette\Forms
Class Rules
List of validation & condition rules.
- Nette\Object
-
Nette\Forms\Rules implements IteratorAggregate, Traversable
public
|
#
__construct(
IFormControl
$control
)
|
public
Rules
|
#
addRule(
mixed
$operation,
string
$message = NULL,
mixed
$arg = NULL
)
Adds a validation rule for the current control. Adds a validation rule for the current control. Parameters$operation mixed rule type$message string message to display for invalid data$arg mixed optional rule argumentsReturnsRules provides a fluent interface
|
public
Rules
|
#
addCondition(
mixed
$operation,
mixed
$arg = NULL
)
Adds a validation condition a returns new branch. Adds a validation condition a returns new branch. Parameters$operation mixed condition type$arg mixed optional condition argumentsReturnsRules new branch
|
public
Rules
|
#
addConditionOn(
IFormControl
$control,
mixed
$operation,
mixed
$arg = NULL
)
Adds a validation condition on specified control a returns new branch. Adds a validation condition on specified control a returns new branch. Parameters$control IFormControl form control$operation mixed condition type$arg mixed optional condition argumentsReturnsRules new branch
|
public
Rules
|
#
elseCondition(
)
Adds a else statement. Adds a else statement. ReturnsRules else branch
|
public
Rules
|
#
endCondition(
)
Ends current validation condition. Ends current validation condition. ReturnsRules parent branch
|
public
Rules
|
#
toggle(
string
$id,
bool
$hide = true
)
Toggles HTML elememnt visibility. Toggles HTML elememnt visibility. Parameters$id string element id$hide bool hide element?ReturnsRules provides a fluent interface
|
public
bool
|
#
validate(
bool
$onlyCheck = false
)
Validates against ruleset. Validates against ruleset. Parameters$onlyCheck bool stop before first error?Returnsbool is valid?
|
final public
\ArrayIterator
|
#
getIterator(
)
Iterates over ruleset. |
final public
array
|
#
getToggles(
)
|
public static
|
#
formatMessage(
$rule,
$withValue
)
|
Methods Inherited From Nette\Object
getReflection(), __call(), __callStatic(), extensionMethod(), __get(), __set(), __isset(), __unset()
VALIDATE_PREFIX |
'validate' # |
static
array
|
$defaultMessages | array ( 'Nette\\Forms\\HiddenField::validateEqual' => 'Security token did not match. Possible CSRF attack.', ':equal' => 'Please enter %s.', ':filled' => 'Please complete mandatory field.', ':minLength' => 'Please enter a value of at least %d characters.', ':maxLength' => 'Please enter a value no longer than %d characters.', ':length' => 'Please enter a value between %d and %d characters long.', ':email' => 'Please enter a valid email address.', ':url' => 'Please enter a valid URL.', ':integer' => 'Please enter a numeric value.', ':float' => 'Please enter a numeric value.', ':range' => 'Please enter a value between %d and %d.', ':fileSize' => 'The size of the uploaded file can be up to %d bytes.', ':image' => 'The uploaded file must be image in format JPEG, GIF or PNG.', ) |
# |