Class Form (namespace Nette\Forms)
Creates, validates and renders HTML forms.
Object | --Component | --ComponentContainer | --FormContainer | --Form
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 |
Adds fieldset group to the form.
|
void |
Cross-Site Request Forgery (CSRF) form protection.
|
void |
addTracker
()
|
void |
cleanErrors
()
|
void |
fireEvents
()
Fires submit/click events.
|
mixed |
getAction
()
Returns form's action.
|
Html |
Returns form's HTML element template.
|
string |
getEncoding
()
Returns the encoding.
|
array |
getErrors
()
Returns validation errors.
|
Form |
getForm
([$need =
TRUE ])
Returns self.
|
FormGroup |
getGroup
(string $name)
Returns the specified group.
|
array |
getGroups
()
Returns all defined groups.
|
array |
getHttpData
()
Returns submitted HTTP data.
|
string |
getMethod
()
Returns form's method.
|
IFormRenderer|NULL |
getRenderer
()
Returns form renderer.
|
ITranslator|NULL |
Returns translate adapter.
|
array |
getValues
()
Returns the values submitted by the form.
|
bool |
hasErrors
()
|
bool |
isAnchored
()
Tells if the form is anchored.
|
ISubmitterControl|FALSE |
isSubmitted
()
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 |
__toString
()
Renders form to string.
|
Protected Method Summary | |
---|---|
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.
|
protected IHttpRequest |
|
protected Session |
getSession
()
|
protected array |
Internal: receives submitted HTTP data.
|
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 __constructpublic Form __construct ([string $name = Form constructor. Overridden in child classes as:
|
|||||||||||||||
line 539 addErrorpublic void addError (string $message) Adds error message to the list.
|
|||||||||||||||
line 262 addGrouppublic FormGroup addGroup ([string $caption = Adds fieldset group to the form.
|
|||||||||||||||
line 240 addProtectionpublic void addProtection ([string $message = Cross-Site Request Forgery (CSRF) form protection.
|
|||||||||||||||
line 227 addTrackerpublic void addTracker ()
|
|||||||||||||||
line 153 attachedprotected 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:
|
|||||||||||||||
line 573 cleanErrorspublic void cleanErrors ()
|
|||||||||||||||
line 450 fireEventspublic void fireEvents () Fires submit/click events.
|
|||||||||||||||
line 190 getActionpublic mixed getAction () Returns form's action.
|
|||||||||||||||
line 589 getElementPrototypepublic Html getElementPrototype () Returns form's HTML element template.
|
|||||||||||||||
line 351 getEncodingpublic string getEncoding () Returns the encoding.
|
|||||||||||||||
line 553 getErrorspublic array getErrors () Returns validation errors.
|
|||||||||||||||
line 166 getFormpublic Form getForm ([$need = Returns self.
|
|||||||||||||||
line 324 getGrouppublic FormGroup getGroup (string $name) Returns the specified group.
|
|||||||||||||||
line 312 getGroupspublic array getGroups () Returns all defined groups.
|
|||||||||||||||
line 433 getHttpDatapublic array getHttpData () Returns submitted HTTP data.
|
|||||||||||||||
line 675 getHttpRequestprotected IHttpRequest getHttpRequest ()
|
|||||||||||||||
line 217 getMethodpublic string getMethod () Returns form's method.
|
|||||||||||||||
line 613 getRendererpublic IFormRenderer|NULL getRenderer () Returns form renderer.
|
|||||||||||||||
line 685 getSessionprotected Session getSession ()
|
|||||||||||||||
line 379 getTranslatorpublic ITranslator|NULL getTranslator () Returns translate adapter.
|
|||||||||||||||
line 521 getValuespublic array getValues () Returns the values submitted by the form.
|
|||||||||||||||
line 563 hasErrorspublic bool hasErrors ()
|
|||||||||||||||
line 394 isAnchoredpublic bool isAnchored () Tells if the form is anchored. Overridden in child classes as:
|
|||||||||||||||
line 405 isSubmittedpublic ISubmitterControl|FALSE isSubmitted () Tells if the form was submitted.
|
|||||||||||||||
line 506 processHttpRequestpublic void processHttpRequest ()
|
|||||||||||||||
line 478 receiveHttpDataprotected array receiveHttpData () Internal: receives submitted HTTP data. Overridden in child classes as:
|
|||||||||||||||
line 286 removeGrouppublic void removeGroup (string|FormGroup $name) Removes fieldset group from form.
|
|||||||||||||||
line 627 renderpublic void render () Renders form.
|
|||||||||||||||
line 178 setActionpublic Form setAction (mixed $url) Sets form's action.
|
|||||||||||||||
line 336 setEncodingpublic Form setEncoding (string $value) Set the encoding for the values.
|
|||||||||||||||
line 202 setMethodpublic Form setMethod (string $method) Sets form's method.
|
|||||||||||||||
line 601 setRendererpublic Form setRenderer (IFormRenderer $renderer) Sets form renderer.
|
|||||||||||||||
line 421 setSubmittedBypublic Form setSubmittedBy ([ISubmitterControl $by = Sets the submittor control.
|
|||||||||||||||
line 367 setTranslatorpublic Form setTranslator ([$translator = Sets translate adapter.
|
|||||||||||||||
line 647 __toStringpublic bool __toString () Renders form to string.
|