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 Form

Creates, validates and renders HTML forms.

Nette\ComponentModel\Component implements Nette\ComponentModel\IComponent uses Nette\SmartObject
Extended by Nette\ComponentModel\Container implements Nette\ComponentModel\IContainer
Extended by Nette\Forms\Container implements ArrayAccess
Extended by Nette\Forms\Form implements Nette\Utils\IHtmlString

Direct known subclasses

Nette\Application\UI\Form
Namespace: Nette\Forms
Located at Forms/Form.php
Methods summary
public
# __construct( string $name = null )

Form constructor.

Form constructor.

Parameters

$name

Overrides

Nette\ComponentModel\Component::__construct()
protected
# validateParent( Nette\ComponentModel\IContainer $parent )

Throws

Nette\InvalidStateException
Nette\InvalidStateException

Overrides

Nette\ComponentModel\Component::validateParent()
protected
# attached( Nette\ComponentModel\IComponent $obj )

This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.

This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.

Parameters

$obj

Overrides

Nette\ComponentModel\Component::attached()
public Nette\Forms\Form
# getForm( boolean $throw = true )

Returns self.

Returns self.

Parameters

$throw

Returns

Nette\Forms\Form
static

Overrides

Nette\Forms\Container::getForm()
public Nette\Forms\Form
# setAction( string|object $url )

Sets form's action.

Sets form's action.

Parameters

$url

Returns

Nette\Forms\Form
static
public mixed
# getAction( )

Returns form's action.

Returns form's action.

Returns

mixed
mixed
public Nette\Forms\Form
# setMethod( string $method )

Sets form's method GET or POST.

Sets form's method GET or POST.

Parameters

$method

Returns

Nette\Forms\Form
static
public string
# getMethod( )

Returns form's method.

Returns form's method.

Returns

string
string
public boolean
# isMethod( string $method )

Checks if the request method is the given one.

Checks if the request method is the given one.

Parameters

$method

Returns

boolean
bool
public Nette\Forms\Controls\CsrfProtection
# addProtection( string $errorMessage = null )

Cross-Site Request Forgery (CSRF) form protection.

Cross-Site Request Forgery (CSRF) form protection.

Parameters

$errorMessage

Returns

Nette\Forms\Controls\CsrfProtection
Controls\CsrfProtection
public Nette\Forms\ControlGroup
# addGroup( string $caption = null, boolean $setAsCurrent = true )

Adds fieldset group to the form.

Adds fieldset group to the form.

Parameters

$caption
$setAsCurrent

Returns

Nette\Forms\ControlGroup
ControlGroup
public
# removeGroup( string|integer|Nette\Forms\ControlGroup $name )

Removes fieldset group from form.

Removes fieldset group from form.

Parameters

$name
public Nette\Forms\ControlGroup[]
# getGroups( )

Returns all defined groups.

Returns all defined groups.

Returns

Nette\Forms\ControlGroup[]
ControlGroup[]
public Nette\Forms\ControlGroup|null
# getGroup( string|integer $name )

Returns the specified group.

Returns the specified group.

Parameters

$name

Returns

Nette\Forms\ControlGroup|null
ControlGroup|null
public Nette\Forms\Form
# setTranslator( Nette\Localization\ITranslator $translator = null )

Sets translate adapter.

Sets translate adapter.

Returns

Nette\Forms\Form
static
public Nette\Localization\ITranslator|null
# getTranslator( )

Returns translate adapter.

Returns translate adapter.

Returns

Nette\Localization\ITranslator|null
Nette\Localization\ITranslator|null
public boolean
# isAnchored( )

Tells if the form is anchored.

Tells if the form is anchored.

Returns

boolean
bool
public Nette\Forms\ISubmitterControl|boolean
# isSubmitted( )

Tells if the form was submitted.

Tells if the form was submitted.

Returns

Nette\Forms\ISubmitterControl|boolean
submittor control
public boolean
# isSuccess( )

Tells if the form was submitted and successfully validated.

Tells if the form was submitted and successfully validated.

Returns

boolean
bool
public Nette\Forms\Form
# setSubmittedBy( Nette\Forms\ISubmitterControl $by = null )

Sets the submittor control.

Sets the submittor control.

Returns

Nette\Forms\Form
static

Internal

public mixed
# getHttpData( integer $type = null, string $htmlName = null )

Returns submitted HTTP data.

Returns submitted HTTP data.

Parameters

$type
$htmlName

Returns

mixed
mixed
public
# fireEvents( )

Fires submit/click events.

Fires submit/click events.

public Nette\Forms\Form
# reset( )

Resets form.

Resets form.

Returns

Nette\Forms\Form
static
protected array|null
# receiveHttpData( )

Internal: returns submitted HTTP data or null when form was not submitted.

Internal: returns submitted HTTP data or null when form was not submitted.

Returns

array|null
array|null
public
# validate( array $controls = null )

Parameters

$controls

Overrides

Nette\Forms\Container::validate()
public
# validateMaxPostSize( )

Internal

public
# addError( string|object $message, $translate = true )

Adds global error message.

Adds global error message.

Parameters

$message
$translate
public array
# getErrors( )

Returns global validation errors.

Returns global validation errors.

Returns

array
array

Overrides

Nette\Forms\Container::getErrors()
public boolean
# hasErrors( )

Returns

boolean
bool
public
# cleanErrors( )
public array
# getOwnErrors( )

Returns form's validation errors.

Returns form's validation errors.

Returns

array
array
public Nette\Utils\Html
# getElementPrototype( )

Returns form's HTML element template.

Returns form's HTML element template.

Returns

Nette\Utils\Html
Html
public Nette\Forms\Form
# setRenderer( Nette\Forms\IFormRenderer $renderer = null )

Sets form renderer.

Sets form renderer.

Returns

Nette\Forms\Form
static
public Nette\Forms\IFormRenderer
# getRenderer( )

Returns form renderer.

Returns form renderer.

Returns

Nette\Forms\IFormRenderer
IFormRenderer
protected
# beforeRender( )
public
# fireRenderEvents( )

Must be called before form is rendered and render() is not used.

Must be called before form is rendered and render() is not used.

public
# render( ... $args )

Renders form.

Renders form.

public string
# __toString( )

Renders form to string.

Renders form to string.

Returns

string
string

Implementation of

Nette\Utils\IHtmlString::__toString()
public array
# getToggles( )

Returns

array
array
Methods inherited from Nette\Forms\Container
__call(), __clone(), addButton(), addCheckbox(), addCheckboxList(), addComponent(), addContainer(), addEmail(), addHidden(), addImage(), addInteger(), addMultiSelect(), addMultiUpload(), addPassword(), addRadioList(), addSelect(), addSubmit(), addText(), addTextArea(), addUpload(), extensionMethod(), getControls(), getCurrentGroup(), getValues(), isValid(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), setCurrentGroup(), setDefaults(), setValues()
Methods inherited from Nette\ComponentModel\Container
_isCloning(), createComponent(), getComponent(), getComponents(), removeComponent(), validateChildComponent()
Methods inherited from Nette\ComponentModel\Component
__sleep(), __wakeup(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), setParent(), unmonitor()
Methods used from Nette\SmartObject
__callStatic(), __get(), __isset(), __set(), __unset(), getReflection()
Constants summary
string EQUAL

validator

validator

#':equal'
string IS_IN

validator

validator

#Nette\Forms\Form::EQUAL
string NOT_EQUAL

validator

validator

#':notEqual'
string IS_NOT_IN

validator

validator

#Nette\Forms\Form::NOT_EQUAL
string FILLED

validator

validator

#':filled'
string BLANK

validator

validator

#':blank'
string REQUIRED

validator

validator

#Nette\Forms\Form::FILLED
string VALID

validator

validator

#':valid'
string SUBMITTED

validator

validator

#':submitted'
string MIN_LENGTH

validator

validator

#':minLength'
string MAX_LENGTH

validator

validator

#':maxLength'
string LENGTH

validator

validator

#':length'
string EMAIL

validator

validator

#':email'
string URL

validator

validator

#':url'
string PATTERN

validator

validator

#':pattern'
string PATTERN_ICASE

validator

validator

#':patternCaseInsensitive'
string INTEGER

validator

validator

#':integer'
string NUMERIC

validator

validator

#':integer'
string FLOAT

validator

validator

#':float'
string MIN

validator

validator

#':min'
string MAX

validator

validator

#':max'
string RANGE

validator

validator

#':range'
string COUNT

validator

validator

#Nette\Forms\Form::LENGTH
string MAX_FILE_SIZE

validator

validator

#':fileSize'
string MIME_TYPE

validator

validator

#':mimeType'
string IMAGE

validator

validator

#':image'
string MAX_POST_SIZE

validator

validator

#':maxPostSize'
string PROTECTION

Deprecated

CSRF protection
#Nette\Forms\Controls\CsrfProtection::PROTECTION
string GET

method

method

#'get'
string POST

method

method

#'post'
integer DATA_TEXT

submitted data types

submitted data types

#1
integer DATA_LINE

submitted data types

submitted data types

#2
integer DATA_FILE

submitted data types

submitted data types

#3
integer DATA_KEYS

submitted data types

submitted data types

#8
string TRACKER_ID

Internal

tracker ID
#'_form_'
string PROTECTOR_ID

Internal

protection token ID
#'_token_'
Constants inherited from Nette\ComponentModel\IComponent
NAME_SEPARATOR
Properties summary
public callable[] $onSuccess

function (Form $sender); Occurs when the form is submitted and successfully validated

function (Form $sender); Occurs when the form is submitted and successfully validated

#
public callable[] $onError

function (Form $sender); Occurs when the form is submitted and is not valid

function (Form $sender); Occurs when the form is submitted and is not valid

#
public callable[] $onSubmit

function (Form $sender); Occurs when the form is submitted

function (Form $sender); Occurs when the form is submitted

#
public callable[] $onRender

function (Form $sender); Occurs before the form is rendered

function (Form $sender); Occurs before the form is rendered

#
public Nette\Http\IRequest $httpRequest

used only by standalone form

used only by standalone form

#
Properties inherited from Nette\Forms\Container
$currentGroup, $onValidate
Magic properties summary
public string $action
public string $method
public read-only array $errors
public read-only array $ownErrors
public read-only Nette\Utils\Html $elementPrototype
public read-only Nette\Forms\IFormRenderer $renderer
Magic properties inherited from Nette\Forms\Container
$controls, $form, $values
Magic properties inherited from Nette\ComponentModel\Container
$components
Magic properties inherited from Nette\ComponentModel\Component
$name, $parent
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0