Packages

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • none

Classes

Interfaces

  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage

Class Form

Creates, validates and renders HTML forms.

Object
Extended by Component implements IComponent
Extended by ComponentContainer implements IComponentContainer
Extended by FormContainer implements ArrayAccess
Extended by Form

Direct known subclasses

AppForm
Package: 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

Component::__construct()
protected
# attached( 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
IComponent

Overrides

Component::attached()
public Form
# getForm( boolean $need = TRUE )

Returns self.

Returns self.

Parameters

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

Returns

Form

Overrides

FormContainer::getForm()
public Form
# setAction( mixed $url )

Sets form's action.

Sets form's action.

Parameters

$url
mixed
URI

Returns

Form
public mixed
# getAction( )

Returns form's action.

Returns form's action.

Returns

mixed
URI
public Form
# setMethod( string $method )

Sets form's method.

Sets form's method.

Parameters

$method
string
get | post

Returns

Form
public string
# getMethod( )

Returns form's method.

Returns form's method.

Returns

string
get | post
public
# addProtection( string $message = NULL, integer $timeout = NULL )

Cross-Site Request Forgery (CSRF) form protection.

Cross-Site Request Forgery (CSRF) form protection.

Parameters

$message
string
$timeout
integer
public FormGroup
# 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

FormGroup
public
# removeGroup( string|ControlGroup $name )

Removes fieldset group from form.

Removes fieldset group from form.

Parameters

$name
string|ControlGroup
public FormGroup[]
# getGroups( )

Returns all defined groups.

Returns all defined groups.

Returns

FormGroup[]
public FormGroup
# getGroup( string $name )

Returns the specified group.

Returns the specified group.

Parameters

$name
string
name

Returns

FormGroup
public Form
# setTranslator( ITranslator $translator = NULL )

Sets translate adapter.

Sets translate adapter.

Returns

Form
public ITranslator|null
# getTranslator( )

Returns translate adapter.

Returns translate adapter.

Returns

ITranslator|null
public boolean
# isAnchored( )

Tells if the form is anchored.

Tells if the form is anchored.

Returns

boolean
public ISubmitterControl|false
# isSubmitted( )

Tells if the form was submitted.

Tells if the form was submitted.

Returns

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 Form
# setSubmittedBy( ISubmitterControl $by = NULL )

Sets the submittor control.

Sets the submittor control.

Returns

Form
public array
# getHttpData( )

Returns submitted HTTP data.

Returns submitted HTTP data.

Returns

array
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 ArrayHash|array
# getValues( boolean $asArray = FALSE )

Returns the values submitted by the form.

Returns the values submitted by the form.

Parameters

$asArray
boolean
return values as an array?

Returns

ArrayHash|array

Overrides

FormContainer::getValues()
public
# addError( string $message )

Adds error message to the list.

Adds error message to the list.

Parameters

$message
string
error message
public array
# getErrors( )

Returns validation errors.

Returns validation errors.

Returns

array
public boolean
# hasErrors( )

Returns

boolean
public
# cleanErrors( )
public Html
# getElementPrototype( )

Returns form's HTML element template.

Returns form's HTML element template.

Returns

Html
public Form
# setRenderer( IFormRenderer $renderer )

Sets form renderer.

Sets form renderer.

Returns

Form
public IFormRenderer
# getRenderer( )

Returns form renderer.

Returns form renderer.

Returns

IFormRenderer
public
# render( )

Renders form.

Renders form.

public can
# __toString( )

Renders form to string.

Renders form to string.

Returns

can
throw exceptions? (hidden parameter)
string
protected IHttpRequest
# getHttpRequest( )

Returns

IHttpRequest
protected Session
# getSession( )

Returns

Session
Methods inherited from FormContainer
__clone(), addButton(), addCheckbox(), addComponent(), addContainer(), addFile(), addHidden(), addImage(), addMultiSelect(), addPassword(), addRadioList(), addSelect(), addSubmit(), addText(), addTextArea(), addUpload(), getControls(), getCurrentGroup(), isValid(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), setCurrentGroup(), setDefaults(), setValues(), validate()
Methods inherited from ComponentContainer
createComponent(), getComponent(), getComponents(), removeComponent(), validateChildComponent()
Methods inherited from Component
__sleep(), __wakeup(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), unmonitor(), validateParent()
Methods inherited from Object
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Methods inherited from IComponent
setParent()
Constants summary
string EQUAL ':equal'
#

validator

validator

string IS_IN ':equal'
#

validator

validator

string NOT_EQUAL ':notEqual'
#

validator

validator

string FILLED ':filled'
#

validator

validator

string BLANK ':blank'
#

validator

validator

string REQUIRED Form::FILLED
#

validator

validator

string VALID ':valid'
#

validator

validator

string PROTECTION 'HiddenField::validateEqual'
#
string SUBMITTED ':submitted'
#
string MIN_LENGTH ':minLength'
#
string MAX_LENGTH ':maxLength'
#
string LENGTH ':length'
#
string EMAIL ':email'
#
string URL ':url'
#
string REGEXP ':regexp'
#
string PATTERN ':pattern'
#
string INTEGER ':integer'
#
string NUMERIC ':integer'
#
string FLOAT ':float'
#
string RANGE ':range'
#
string COUNT ':length'
#
string MAX_FILE_SIZE ':fileSize'
#
string MIME_TYPE ':mimeType'
#
string IMAGE ':image'
#
string GET 'get'
#

method

method

string POST 'post'
#

method

method

string TRACKER_ID '_form_'
#
string PROTECTOR_ID '_token_'
#
Constants inherited from IComponent
NAME_SEPARATOR
Properties summary
public array $onSuccess
#

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

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

public array $onError
#

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

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

public array $onSubmit
#

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

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

public $onInvalidSubmit
#

Deprecated

public IHttpRequest $httpRequest
#

used only by standalone form

used only by standalone form

Properties inherited from FormContainer
$currentGroup, $onValidate, $valid
Magic properties summary
public mixed $action
#
public string $method
#
public ITranslator|null $translator
#
public IFormRenderer $renderer
#
public read-only array $groups
#
public read-only boolean $anchored
#
public read-only ISubmitterControl|false $submitted
#
public read-only boolean $success
#
public read-only array $httpData
#
public read-only array $errors
#
public read-only Html $elementPrototype
#
Magic properties inherited from FormContainer
$controls, $currentGroup, $defaults, $form, $valid, $values
Magic properties inherited from ComponentContainer
$components
Magic properties inherited from Component
$name, $parent
Magic properties inherited from Object
$reflection
Nette Framework 2.0.18 (for PHP 5.2, un-prefixed) API documentation generated by ApiGen 2.8.0