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 56 operation name |
string | EQUAL |
':equal' |
line 44 operation name |
string | FILLED |
':filled' |
line 46 operation name |
string | FLOAT |
':float' |
line 61 operation name |
string | GET |
'get' |
line 73 method |
string | INTEGER |
':integer' |
line 59 operation name |
string | IS_IN |
':equal' |
line 45 operation name |
string | LENGTH |
':length' |
line 55 operation name |
string | MAX_FILE_SIZE |
':fileSize' |
line 65 operation name |
string | MAX_LENGTH |
':maxLength' |
line 54 operation name |
string | MIME_TYPE |
':mimeType' |
line 66 operation name |
string | MIN_LENGTH |
':minLength' |
line 53 operation name |
string | NUMERIC |
':integer' |
line 60 operation name |
string | POST |
'post' |
line 74 method |
string | RANGE |
':range' |
line 62 operation name |
string | REGEXP |
':regexp' |
line 58 operation name |
string | SCRIPT |
'Nette\Forms\InstantClientScript::javascript' |
line 69 operation name |
string | SUBMITTED |
':submitted' |
line 50 operation name |
string | URL |
':url' |
line 57 operation name |
string | VALID |
':valid' |
line 47 operation name |
Variable Summary | ||||
---|---|---|---|---|
array | $onInvalidSubmit |
|
line 87 of function(Form $sender); Occurs when the form is submitted and not validated |
|
array | $onSubmit |
|
line 84 of function(Form $sender); Occurs when the form is submitted and successfully validated |
Method Details | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 119 __constructpublic Form __construct ([string $name = Form constructor. Overridden in child classes as:
|
|||||||||||||||
line 528 addErrorpublic void addError (string $message) Adds error message to the list.
|
|||||||||||||||
line 250 addGrouppublic FormGroup addGroup ([string $caption = Adds fieldset group to the form.
|
|||||||||||||||
line 228 addProtectionpublic void addProtection ([string $message = Cross-Site Request Forgery (CSRF) form protection.
|
|||||||||||||||
line 215 addTrackerpublic void addTracker ()
|
|||||||||||||||
line 141 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 562 cleanErrorspublic void cleanErrors ()
|
|||||||||||||||
line 438 fireEventspublic void fireEvents () Fires submit/click events.
|
|||||||||||||||
line 178 getActionpublic mixed getAction () Returns form's action.
|
|||||||||||||||
line 578 getElementPrototypepublic Html getElementPrototype () Returns form's HTML element template.
|
|||||||||||||||
line 339 getEncodingpublic string getEncoding () Returns the encoding.
|
|||||||||||||||
line 542 getErrorspublic array getErrors () Returns validation errors.
|
|||||||||||||||
line 154 getFormpublic Form getForm ([$need = Returns self.
|
|||||||||||||||
line 312 getGrouppublic FormGroup getGroup (string $name) Returns the specified group.
|
|||||||||||||||
line 300 getGroupspublic array getGroups () Returns all defined groups.
|
|||||||||||||||
line 421 getHttpDatapublic array getHttpData () Returns submitted HTTP data.
|
|||||||||||||||
line 663 getHttpRequestprotected IHttpRequest getHttpRequest ()
|
|||||||||||||||
line 205 getMethodpublic string getMethod () Returns form's method.
|
|||||||||||||||
line 602 getRendererpublic IFormRenderer|NULL getRenderer () Returns form renderer.
|
|||||||||||||||
line 673 getSessionprotected Session getSession ()
|
|||||||||||||||
line 367 getTranslatorpublic ITranslator|NULL getTranslator () Returns translate adapter.
|
|||||||||||||||
line 510 getValuespublic array getValues () Returns the values submitted by the form.
|
|||||||||||||||
line 552 hasErrorspublic bool hasErrors ()
|
|||||||||||||||
line 382 isAnchoredpublic bool isAnchored () Tells if the form is anchored. Overridden in child classes as:
|
|||||||||||||||
line 393 isSubmittedpublic ISubmitterControl|FALSE isSubmitted () Tells if the form was submitted.
|
|||||||||||||||
line 494 processHttpRequestpublic void processHttpRequest ()
|
|||||||||||||||
line 466 receiveHttpDataprotected array receiveHttpData () Internal: receives submitted HTTP data. Overridden in child classes as:
|
|||||||||||||||
line 274 removeGrouppublic void removeGroup (string|FormGroup $name) Removes fieldset group from form.
|
|||||||||||||||
line 616 renderpublic void render () Renders form.
|
|||||||||||||||
line 166 setActionpublic Form setAction (mixed $url) Sets form's action.
|
|||||||||||||||
line 324 setEncodingpublic Form setEncoding (string $value) Set the encoding for the values.
|
|||||||||||||||
line 190 setMethodpublic Form setMethod (string $method) Sets form's method.
|
|||||||||||||||
line 590 setRendererpublic Form setRenderer (IFormRenderer $renderer) Sets form renderer.
|
|||||||||||||||
line 409 setSubmittedBypublic Form setSubmittedBy ([ISubmitterControl $by = Sets the submittor control.
|
|||||||||||||||
line 355 setTranslatorpublic Form setTranslator ([$translator = Sets translate adapter.
|
|||||||||||||||
line 636 __toStringpublic bool __toString () Renders form to string.
|