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
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Utils
  • none
  • Tracy
    • Bridges
      • Nette

Classes

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

Interfaces

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

Class Form

Creates, validates and renders HTML forms.

Nette\Object
Extended by Nette\ComponentModel\Component implements Nette\ComponentModel\IComponent
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 $need = TRUE )

Returns self.

Returns self.

Parameters

$need
exception if form doesn't exist?

Returns

Nette\Forms\Form
static

Overrides

Nette\Forms\Container::getForm()
public Nette\Forms\Form
# setAction( mixed $url )

Sets form's action.

Sets form's action.

Parameters

$url
URI

Returns

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

Returns form's action.

Returns form's action.

Returns

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

Sets form's method.

Sets form's method.

Parameters

$method
| post

Returns

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

Returns form's method.

Returns form's method.

Returns

string
get | post
public Nette\Forms\Controls\CsrfProtection
# addProtection( string $message = NULL )

Cross-Site Request Forgery (CSRF) form protection.

Cross-Site Request Forgery (CSRF) form protection.

Parameters

$message

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
caption
$setAsCurrent
this group as current

Returns

Nette\Forms\ControlGroup
ControlGroup
public
# removeGroup( string|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
# getGroup( string $name )

Returns the specified group.

Returns the specified group.

Parameters

$name
name

Returns

Nette\Forms\ControlGroup
ControlGroup
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|false
# isSubmitted( )

Tells if the form was submitted.

Tells if the form was submitted.

Returns

Nette\Forms\ISubmitterControl|false
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 mixed
# getHttpData( $type = NULL, $htmlName = NULL )

Returns submitted HTTP data.

Returns submitted HTTP data.

Returns

mixed
mixed
public
# fireEvents( )

Fires submit/click events.

Fires submit/click events.

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 )

Performs the server side validation.

Performs the server side validation.

Parameters

$controls

Overrides

Nette\Forms\Container::validate()
public
# addError( string $message )

Adds global error message.

Adds global error message.

Parameters

$message
message
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
Nette\Utils\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
public
# render( )

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
__clone(), addButton(), addCheckbox(), addCheckboxList(), addComponent(), addContainer(), addHidden(), addImage(), addMultiSelect(), addMultiUpload(), addPassword(), addRadioList(), addSelect(), addSubmit(), addText(), addTextArea(), addUpload(), getControls(), getCurrentGroup(), getValues(), isValid(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), setCurrentGroup(), setDefaults()
Methods inherited from Nette\ComponentModel\Container
createComponent(), getComponent(), getComponents(), removeComponent(), validateChildComponent()
Methods inherited from Nette\ComponentModel\Component
__sleep(), __wakeup(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), unmonitor()
Methods inherited from Nette\Object
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Methods inherited from Nette\ComponentModel\IComponent
setParent()
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 PROTECTION

Deprecated

CSRF protection
#Nette\Forms\Controls\CsrfProtection::PROTECTION
string SUBMITTED
#':submitted'
string MIN_LENGTH
#':minLength'
string MAX_LENGTH
#':maxLength'
string LENGTH
#':length'
string EMAIL
#':email'
string URL
#':url'
string PATTERN
#':pattern'
string INTEGER
#':integer'
string NUMERIC
#':integer'
string FLOAT
#':float'
string MIN
#':min'
string MAX
#':max'
string RANGE
#':range'
string COUNT
#Nette\Forms\Form::LENGTH
string MAX_FILE_SIZE
#':fileSize'
string MIME_TYPE
#':mimeType'
string IMAGE
#':image'
string MAX_POST_SIZE
#':maxPostSize'
string GET

method

method

#'get'
string POST

method

method

#'post'
integer DATA_TEXT

submitted data types

submitted data types

#1
integer DATA_LINE
#2
integer DATA_FILE
#3
integer DATA_KEYS
#8
string TRACKER_ID
#'_form_'
string PROTECTOR_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 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 read-only array $errors
public read-only Nette\Utils\Html $elementPrototype
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
Magic properties inherited from Nette\Object
$reflection
Nette 2.3-20161221 API API documentation generated by ApiGen 2.8.0