Class Form (namespace Nette\Forms)


Creates, validates and renders HTML forms.

Direct Known Sub-classes:

Public Method Summary
Form
__construct ([string $name = NULL])
Form constructor.
void
addError (string $message)
Adds error message to the list.
FormGroup
addGroup ([string $caption = NULL], [bool $setAsCurrent = TRUE])
Adds fieldset group to the form.
void
addProtection ([string $message = NULL], [int $timeout = NULL])
Cross-Site Request Forgery (CSRF) form protection.
void
void
void
Fires submit/click events.
mixed
Returns form's action.
Html
Returns form's HTML element template.
string
Returns the encoding.
array
Returns validation errors.
Form
getForm ([$need = TRUE])
Returns self.
FormGroup
getGroup (string $name)
Returns the specified group.
array
Returns all defined groups.
array
Returns submitted HTTP data.
string
Returns form's method.
IFormRenderer|NULL
Returns form renderer.
ITranslator|NULL
Returns translate adapter.
array
Returns the values submitted by the form.
bool
bool
Tells if the form is anchored.
ISubmitterControl|FALSE
Tells if the form was submitted.
void
void
removeGroup (string|FormGroup $name)
Removes fieldset group from form.
void
render ()
Renders form.
Form
setAction (mixed $url)
Sets form's action.
Form
setEncoding (string $value)
Set the encoding for the values.
Form
setMethod (string $method)
Sets form's method.
Form
setRenderer (IFormRenderer $renderer)
Sets form renderer.
Form
Sets the submittor control.
Form
setTranslator ([$translator = NULL])
Sets translate adapter.
bool
Renders form to string.
Protected Method Summary
protected void
This method will be called when the component (or component's parent) becomes attached to a monitored object. Do not call this method yourself.
protected IHttpRequest
protected Session
protected array
Internal: receives submitted HTTP data.
Methods Inherited From FormContainer
addButton(), addCheckbox(), addComponent(), addContainer(), addFile(), addHidden(), addImage(), addMultiSelect(), addPassword(), addRadioList(), addRepeater(), addSelect(), addSubmit(), addText(), addTextArea(), getControls(), getForm(), getValues(), isValid(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), setCurrentGroup(), setDefaults(), setValues(), validate(), __clone()
Methods Inherited From ComponentContainer
addComponent(), createComponent(), getComponent(), getComponents(), removeComponent(), validateChildComponent(), __clone()
Methods Inherited From Component
__construct(), attached(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), setParent(), unmonitor(), validateParent(), __clone(), __wakeup()
Methods Inherited From Object
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()
Constant Summary
string EMAIL ':email'

line 68

operation name
string EQUAL ':equal'

line 56

operation name
string FILLED ':filled'

line 58

operation name
string FLOAT ':float'

line 73

operation name
string GET 'get'

line 85

method
string INTEGER ':integer'

line 71

operation name
string IS_IN ':equal'

line 57

operation name
string LENGTH ':length'

line 67

operation name
string MAX_FILE_SIZE ':fileSize'

line 77

operation name
string MAX_LENGTH ':maxLength'

line 66

operation name
string MIME_TYPE ':mimeType'

line 78

operation name
string MIN_LENGTH ':minLength'

line 65

operation name
string NUMERIC ':integer'

line 72

operation name
string POST 'post'

line 86

method
string RANGE ':range'

line 74

operation name
string REGEXP ':regexp'

line 70

operation name
string SCRIPT 'Nette\Forms\InstantClientScript::javascript'

line 81

operation name
string SUBMITTED ':submitted'

line 62

operation name
string URL ':url'

line 69

operation name
string VALID ':valid'

line 59

operation name
Variable Summary
array $onInvalidSubmit

line 99

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

line 96

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

Method Details

line 131

__construct

public Form __construct ([string $name = NULL])

Form constructor.

Overridden in child classes as:

Input
string $name
Output
Form  

line 539

addError

public void addError (string $message)

Adds error message to the list.

Input
string $message error message
Output
void  

line 262

addGroup

public FormGroup addGroup ([string $caption = NULL], [bool $setAsCurrent = TRUE])

Adds fieldset group to the form.

Input
string $caption caption
bool $setAsCurrent set this group as current
Output
FormGroup  

line 240

addProtection

public void addProtection ([string $message = NULL], [int $timeout = NULL])

Cross-Site Request Forgery (CSRF) form protection.

Input
string $message
int $timeout
Output
void  

line 227

addTracker

public void addTracker ()

Output
void  
Tags
Deprecated

line 153

attached

protected void 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.

Overridden in child classes as:

Input
IComponent $obj
Output
void  

line 573

cleanErrors

public void cleanErrors ()

Output
void  

line 450

fireEvents

public void fireEvents ()

Fires submit/click events.

Output
void  

line 190

getAction

public mixed getAction ()

Returns form's action.

Output
mixed URI

line 589

getElementPrototype

public Html getElementPrototype ()

Returns form's HTML element template.

Output
Html  

line 351

getEncoding

public string getEncoding ()

Returns the encoding.

Output
string  

line 553

getErrors

public array getErrors ()

Returns validation errors.

Output
array  

line 166

getForm

public Form getForm ([$need = TRUE])

Returns self.

Input
$need
Output
Form  

line 324

getGroup

public FormGroup getGroup (string $name)

Returns the specified group.

Input
string $name name
Output
FormGroup  

line 312

getGroups

public array getGroups ()

Returns all defined groups.

Output
array of FormGroup

line 433

getHttpData

public array getHttpData ()

Returns submitted HTTP data.

Output
array  

line 675

getHttpRequest

protected IHttpRequest getHttpRequest ()

Output
IHttpRequest  

line 217

getMethod

public string getMethod ()

Returns form's method.

Output
string get | post

line 613

getRenderer

public IFormRenderer|NULL getRenderer ()

Returns form renderer.

Output
IFormRenderer|NULL  

line 685

getSession

protected Session getSession ()

Output
Session  

line 379

getTranslator

public ITranslator|NULL getTranslator ()

Returns translate adapter.

Output
ITranslator|NULL  

line 521

getValues

public array getValues ()

Returns the values submitted by the form.

Output
array  

line 563

hasErrors

public bool hasErrors ()

Output
bool  

line 394

isAnchored

public bool isAnchored ()

Tells if the form is anchored.

Overridden in child classes as:

Output
bool  

line 405

isSubmitted

public ISubmitterControl|FALSE isSubmitted ()

Tells if the form was submitted.

Output
ISubmitterControl|FALSE submittor control

line 506

processHttpRequest

public void processHttpRequest ()

Output
void  
Tags
Deprecated

line 478

receiveHttpData

protected array receiveHttpData ()

Internal: receives submitted HTTP data.

Overridden in child classes as:

Output
array  

line 286

removeGroup

public void removeGroup (string|FormGroup $name)

Removes fieldset group from form.

Input
string|FormGroup $name
Output
void  

line 627

render

public void render ()

Renders form.

Output
void  

line 178

setAction

public Form setAction (mixed $url)

Sets form's action.

Input
mixed $url URI
Output
Form provides a fluent interface

line 336

setEncoding

public Form setEncoding (string $value)

Set the encoding for the values.

Input
string $value
Output
Form provides a fluent interface

line 202

setMethod

public Form setMethod (string $method)

Sets form's method.

Input
string $method get | post
Output
Form provides a fluent interface

line 601

setRenderer

public Form setRenderer (IFormRenderer $renderer)

Sets form renderer.

Input
IFormRenderer $renderer
Output
Form provides a fluent interface

line 421

setSubmittedBy

public Form setSubmittedBy ([ISubmitterControl $by = NULL])

Sets the submittor control.

Input
ISubmitterControl $by
Output
Form provides a fluent interface

line 367

setTranslator

public Form setTranslator ([$translator = NULL])

Sets translate adapter.

Input
$translator
Output
Form provides a fluent interface

line 647

__toString

public bool __toString ()

Renders form to string.

Output
bool can throw exceptions? (hidden parameter)