Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

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

Interfaces

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

Class Validator

Common validators.

Nette\Forms\Validator uses Nette\StaticClass
Namespace: Nette\Forms
Located at Forms/Validator.php
Methods summary
public static
# formatMessage( Nette\Forms\Rule $rule, $withValue = true )

Internal

public static boolean
# validateEqual( Nette\Forms\IControl $control, $arg )

Is control's value equal with second parameter?

Is control's value equal with second parameter?

Returns

boolean
bool
public static boolean
# validateNotEqual( Nette\Forms\IControl $control, $arg )

Is control's value not equal with second parameter?

Is control's value not equal with second parameter?

Returns

boolean
bool
public static boolean
# validateStatic( Nette\Forms\IControl $control, $arg )

Returns argument.

Returns argument.

Returns

boolean
bool
public static boolean
# validateFilled( Nette\Forms\IControl $control )

Is control filled?

Is control filled?

Returns

boolean
bool
public static boolean
# validateBlank( Nette\Forms\IControl $control )

Is control not filled?

Is control not filled?

Returns

boolean
bool
public static boolean
# validateValid( Nette\Forms\Controls\BaseControl $control )

Is control valid?

Is control valid?

Returns

boolean
bool
public static boolean
# validateRange( Nette\Forms\IControl $control, array $range )

Is a control's value number in specified range?

Is a control's value number in specified range?

Parameters

$control
$range

Returns

boolean
bool
public static boolean
# validateMin( Nette\Forms\IControl $control, float $minimum )

Is a control's value number greater than or equal to the specified minimum?

Is a control's value number greater than or equal to the specified minimum?

Parameters

$control
$minimum

Returns

boolean
bool
public static boolean
# validateMax( Nette\Forms\IControl $control, float $maximum )

Is a control's value number less than or equal to the specified maximum?

Is a control's value number less than or equal to the specified maximum?

Parameters

$control
$maximum

Returns

boolean
bool
public static boolean
# validateLength( Nette\Forms\IControl $control, array|integer $range )

Count/length validator. Range is array, min and max length pair.

Count/length validator. Range is array, min and max length pair.

Parameters

$control
$range

Returns

boolean
bool
public static boolean
# validateMinLength( Nette\Forms\IControl $control, integer $length )

Has control's value minimal count/length?

Has control's value minimal count/length?

Parameters

$control
$length

Returns

boolean
bool
public static boolean
# validateMaxLength( Nette\Forms\IControl $control, integer $length )

Is control's value count/length in limit?

Is control's value count/length in limit?

Parameters

$control
$length

Returns

boolean
bool
public static boolean
# validateSubmitted( Nette\Forms\Controls\SubmitButton $control )

Has been button pressed?

Has been button pressed?

Returns

boolean
bool
public static boolean
# validateEmail( Nette\Forms\IControl $control )

Is control's value valid email address?

Is control's value valid email address?

Returns

boolean
bool
public static boolean
# validateUrl( Nette\Forms\IControl $control )

Is control's value valid URL?

Is control's value valid URL?

Returns

boolean
bool
public static boolean
# validatePattern( Nette\Forms\IControl $control, $pattern, $caseInsensitive = false )

Does the control's value match the regular expression? Case-sensitive to comply with the HTML5 <input /> pattern attribute behaviour

Does the control's value match the regular expression? Case-sensitive to comply with the HTML5 <input /> pattern attribute behaviour

Parameters

$control
$pattern
$caseInsensitive

Returns

boolean
bool
public static
# validatePatternCaseInsensitive( Nette\Forms\IControl $control, $pattern )
public static boolean
# validateInteger( Nette\Forms\IControl $control )

Is a control's value decimal number?

Is a control's value decimal number?

Returns

boolean
bool
public static boolean
# validateFloat( Nette\Forms\IControl $control )

Is a control's value float number?

Is a control's value float number?

Returns

boolean
bool
public static boolean
# validateFileSize( Nette\Forms\Controls\UploadControl $control, $limit )

Is file size in limit?

Is file size in limit?

Parameters

$control
$limit

Returns

boolean
bool
public static boolean
# validateMimeType( Nette\Forms\Controls\UploadControl $control, string|string[] $mimeType )

Has file specified mime type?

Has file specified mime type?

Parameters

$control
$mimeType

Returns

boolean
bool
public static boolean
# validateImage( Nette\Forms\Controls\UploadControl $control )

Is file image?

Is file image?

Returns

boolean
bool
Methods used from Nette\StaticClass
__callStatic(), __construct()
Properties summary
public static array $messages
#[ 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::MIME_TYPE => 'The uploaded file is not in the expected format.', Form::IMAGE => 'The uploaded file must be image in format JPEG, GIF or PNG.', Controls\SelectBox::VALID => 'Please select a valid option.', Controls\UploadControl::VALID => 'An error occurred during file upload.', ]
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0