Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationLatte
      • ApplicationTracy
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsLatte
      • Framework
      • HttpTracy
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Templating
    • Utils
  • NetteModule
  • none
  • Tracy

Classes

  • Container
  • ControlGroup
  • Form
  • Helpers
  • Rule
  • Rules

Interfaces

  • IControl
  • IFormRenderer
  • ISubmitterControl
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage

Class Rules

List of validation & condition rules.

Nette\Object
Extended by Nette\Forms\Rules implements IteratorAggregate
Namespace: Nette\Forms
Author: David Grudl
Located at Forms/Rules.php
Methods summary
public
# __construct( Nette\Forms\IControl $control )
public Nette\Forms\Rules
# setRequired( mixed $value = TRUE )

Makes control mandatory.

Makes control mandatory.

Parameters

$value
mixed
state or error message

Returns

Nette\Forms\Rules
public boolean
# isRequired( )

Is control mandatory?

Is control mandatory?

Returns

boolean
public Nette\Forms\Rules
# addRule( mixed $validator, string $message = NULL, mixed $arg = NULL )

Adds a validation rule for the current control.

Adds a validation rule for the current control.

Parameters

$validator
mixed
rule type
$message
string
message to display for invalid data
$arg
mixed
optional rule arguments

Returns

Nette\Forms\Rules
public Nette\Forms\Rules
# addCondition( mixed $validator, mixed $arg = NULL )

Adds a validation condition and returns new branch.

Adds a validation condition and returns new branch.

Parameters

$validator
mixed
condition type
$arg
mixed
optional condition arguments

Returns

Nette\Forms\Rules
new branch
public Nette\Forms\Rules
# addConditionOn( Nette\Forms\IControl $control, mixed $validator, 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
Nette\Forms\IControl
form control
$validator
mixed
condition type
$arg
mixed
optional condition arguments

Returns

Nette\Forms\Rules
new branch
public Nette\Forms\Rules
# elseCondition( )

Adds a else statement.

Adds a else statement.

Returns

Nette\Forms\Rules
else branch
public Nette\Forms\Rules
# endCondition( )

Ends current validation condition.

Ends current validation condition.

Returns

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

Toggles HTML element visibility.

Toggles HTML element visibility.

Parameters

$id
string
element id
$hide
boolean
hide element?

Returns

Nette\Forms\Rules
public array
# getToggles( boolean $actual = FALSE )

Parameters

$actual
boolean

Returns

array
public boolean
# validate( )

Validates against ruleset.

Validates against ruleset.

Returns

boolean
public static boolean
# validateRule( Nette\Forms\Rule $rule )

Validates single rule.

Validates single rule.

Returns

boolean
public ArrayIterator
# getIterator( )

Iterates over complete ruleset.

Iterates over complete ruleset.

Returns

ArrayIterator

Implementation of

IteratorAggregate::getIterator()
public static
# formatMessage( Nette\Forms\Rule $rule, $withValue = TRUE )
Methods inherited from Nette\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::NOT_EQUAL => 'This value should not be %s.', Form::FILLED => 'This field is required.', Form::BLANK => 'This field should be blank.', Form::MIN_LENGTH => 'Please enter at least %d characters.', Form::MAX_LENGTH => 'Please enter no more 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 valid integer.', Form::FLOAT => 'Please enter a valid number.', Form::MIN => 'Please enter a value greater than or equal to %d.', Form::MAX => 'Please enter a value less than or equal to %d.', 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::MAX_POST_SIZE => 'The uploaded data exceeds the limit of %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.', Nette\Forms\Controls\SelectBox::VALID => 'Please select a valid option.', )
#
Magic properties inherited from Nette\Object
$reflection
Nette 2.2 API documentation generated by ApiGen 2.8.0