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 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
Author: David Grudl
Located at Forms/Form.php
Methods summary
public
# __construct( string $name = NULL )

Form constructor.

Form constructor.

Parameters

$name
string

Overrides

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

Throws

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
Nette\ComponentModel\IComponent

Overrides

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

Returns self.

Returns self.

Parameters

$need
boolean
throw exception if form doesn't exist?

Returns

Nette\Forms\Form

Overrides

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

Sets form's action.

Sets form's action.

Parameters

$url
mixed
URI

Returns

Nette\Forms\Form
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
string
get | post

Returns

Nette\Forms\Form
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
string

Returns

Nette\Forms\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
string
caption
$setAsCurrent
boolean
set this group as current

Returns

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

Removes fieldset group from form.

Removes fieldset group from form.

Parameters

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

Returns all defined groups.

Returns all defined groups.

Returns

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

Returns the specified group.

Returns the specified group.

Parameters

$name
string
name

Returns

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

Sets translate adapter.

Sets translate adapter.

Returns

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

Returns translate adapter.

Returns translate adapter.

Returns

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

Tells if the form is anchored.

Tells if the form is anchored.

Returns

boolean
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
public Nette\Forms\Form
# setSubmittedBy( Nette\Forms\ISubmitterControl $by = NULL )

Sets the submittor control.

Sets the submittor control.

Returns

Nette\Forms\Form
public mixed
# getHttpData( $type = NULL, $htmlName = NULL )

Returns submitted HTTP data.

Returns submitted HTTP data.

Returns

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
public
# validate( array $controls = NULL )

Performs the server side validation.

Performs the server side validation.

Parameters

$controls
Nette\Forms\IControl[]

Overrides

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

Adds global error message.

Adds global error message.

Parameters

$message
string
error message
public array
# getErrors( )

Returns global validation errors.

Returns global validation errors.

Returns

array

Overrides

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

Returns

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

Returns form's validation errors.

Returns form's validation errors.

Returns

array
public
# getAllErrors( )

Deprecated

public Nette\Utils\Html
# getElementPrototype( )

Returns form's HTML element template.

Returns form's HTML element template.

Returns

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

Sets form renderer.

Sets form renderer.

Returns

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

Returns form renderer.

Returns form renderer.

Returns

Nette\Forms\IFormRenderer
public
# render( )

Renders form.

Renders form.

public string
# __toString( )

Renders form to string.

Renders form to string.

Returns

string

Implementation of

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

Returns

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(), setValues()
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 ':equal'
#

validator

validator

string IS_IN Nette\Forms\Form::EQUAL
#

validator

validator

string NOT_EQUAL ':notEqual'
#

validator

validator

string FILLED ':filled'
#

validator

validator

string BLANK ':blank'
#

validator

validator

string REQUIRED Nette\Forms\Form::FILLED
#

validator

validator

string VALID ':valid'
#

validator

validator

string PROTECTION Nette\Forms\Controls\CsrfProtection::PROTECTION
#

Deprecated

CSRF 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 'get'
#

method

method

string POST 'post'
#

method

method

integer DATA_TEXT 1
#

submitted data types

submitted data types

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.2 API documentation generated by ApiGen 2.8.0