Packages

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • none

Classes

Interfaces

  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage

Class Rules

List of validation & condition rules.

Object
Extended by Rules implements IteratorAggregate
Package: Nette\Forms
Author: David Grudl
Located at Forms/Rules.php
Methods summary
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 arguments

Returns

Rules
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 arguments

Returns

Rules
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 arguments

Returns

Rules
new branch
public Rules
# elseCondition( )

Adds a else statement.

Adds a else statement.

Returns

Rules
else branch
public Rules
# endCondition( )

Ends current validation condition.

Ends current validation condition.

Returns

Rules
parent branch
public Rules
# toggle( string $id, boolean $hide = TRUE )

Toggles HTML elememnt visibility.

Toggles HTML elememnt visibility.

Parameters

$id
string
element id
$hide
boolean
hide element?

Returns

Rules
public boolean
# validate( boolean $onlyCheck = FALSE )

Validates against ruleset.

Validates against ruleset.

Parameters

$onlyCheck
boolean
stop before first error?

Returns

boolean
is valid?
public ArrayIterator
# getIterator( )

Iterates over ruleset.

Iterates over ruleset.

Returns

ArrayIterator

Implementation of

IteratorAggregate::getIterator()
public array
# getToggles( )

Returns

array
public static
# formatMessage( $rule, $withValue )
Methods inherited from Object
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Properties summary
public static array $defaultMessages array( Form::PROTECTION => 'Your session has expired. Please return to the home page and try again.', Form::EQUAL => 'Please enter %s.', Form::FILLED => 'Please complete mandatory field.', Form::MIN_LENGTH => 'Please enter a value of at least %d characters.', Form::MAX_LENGTH => 'Please enter a value no longer than %d characters.', Form::LENGTH => 'Please enter a value between %d and %d characters long.', Form::EMAIL => 'Please enter a valid email address.', Form::URL => 'Please enter a valid URL.', Form::INTEGER => 'Please enter a numeric value.', Form::FLOAT => 'Please enter a numeric value.', Form::RANGE => 'Please enter a value between %d and %d.', Form::MAX_FILE_SIZE => 'The size of the uploaded file can be up to %d bytes.', Form::IMAGE => 'The uploaded file must be image in format JPEG, GIF or PNG.', Form::MIME_TYPE => 'The uploaded file is not in the expected format.', )
#
Magic properties inherited from Object
$reflection
Nette Framework 2.0.18 (for PHP 5.2, un-prefixed) API documentation generated by ApiGen 2.8.0