Class Form (namespace Nette\Forms)
Creates, validates and renders HTML forms.
Object | --Component | --ComponentContainer | --FormContainer | --Form
Direct Known Sub-classes:
Public Method Summary | |
---|---|
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.
|
HiddenField |
addTracker
(string $name)
Adds distinguishing mark.
|
void |
cleanErrors
()
|
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.
|
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 |
isPopulated
()
Was form populated by setDefaults() or processHttpRequest() yet?
|
ISubmitterControl|FALSE |
isSubmitted
()
Tells if the form was submitted.
|
bool |
isValid
()
Is form valid?
|
void |
Detects form submission and loads HTTP values.
|
Form |
Form constructor.
|
void |
removeGroup
(string|FormGroup $name)
Removes fieldset group from form.
|
void |
render
()
Renders form.
|
void |
setAction
(mixed $url)
Sets form's action.
|
void |
setDefaults
(array|Traversable $values, [bool $erase =
FALSE ])
Fill-in with default values.
|
void |
setEncoding
(string $value)
Set the encoding for the values.
|
void |
setMethod
(string $method)
Sets form's method.
|
void |
setRenderer
(IFormRenderer $renderer)
Sets form renderer.
|
void |
Sets the submittor control.
|
void |
setTranslator
([$translator =
NULL ])
Sets translate adapter.
|
void |
setValues
(array|Traversable $values, [bool $erase =
FALSE ])
Fill-in with values.
|
void |
validate
()
Performs the server side validation.
|
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 void |
loadHttpData
($data)
Fill-in the form with HTTP data. Doesn't check if form was submitted.
|
protected void |
submit
()
Fires submit/click events.
|
Methods Inherited From ComponentContainer |
---|
addComponent(), createComponent(), getComponent(), getComponents(), removeComponent(), validateChildComponent(), __clone() |
Methods Inherited From Component |
---|
__construct(), attached(), detached(), getName(), getParent(), getService(), getServiceLocator(), lookup(), lookupPath(), monitor(), setParent(), setServiceLocator(), validateParent(), __clone(), __wakeup() |
Methods Inherited From Object |
---|
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset() |
Constant Summary | |||
---|---|---|---|
string | EMAIL |
':email' |
line 70 operation name |
string | EQUAL |
':equal' |
line 58 operation name |
string | FILLED |
':filled' |
line 60 operation name |
string | FLOAT |
':float' |
line 75 operation name |
string | GET |
'get' |
line 87 method |
string | INTEGER |
':integer' |
line 73 operation name |
string | IS_IN |
':equal' |
line 59 operation name |
string | LENGTH |
':length' |
line 69 operation name |
string | MAX_FILE_SIZE |
':fileSize' |
line 79 operation name |
string | MAX_LENGTH |
':maxLength' |
line 68 operation name |
string | MIME_TYPE |
':mimeType' |
line 80 operation name |
string | MIN_LENGTH |
':minLength' |
line 67 operation name |
string | NUMERIC |
':integer' |
line 74 operation name |
string | POST |
'post' |
line 88 method |
string | PROTECTOR_ID |
'_token_' |
line 95 protection token ID |
string | RANGE |
':range' |
line 76 operation name |
string | REGEXP |
':regexp' |
line 72 operation name |
string | SCRIPT |
'Nette\Forms\InstantClientScript::javascript' |
line 83 operation name |
string | SUBMITTED |
':submitted' |
line 64 operation name |
string | TRACKER_ID |
'_form_' |
line 92 tracker ID |
string | URL |
':url' |
line 71 operation name |
string | VALID |
':valid' |
line 61 operation name |
Variable Summary | ||||
---|---|---|---|---|
array | $onInvalidSubmit |
|
line 101 of function(Form $sender); Occurs when the form is submitted and not validated |
|
array | $onSubmit |
|
line 98 of function(Form $sender); Occurs when the form is submitted and successfully validated |
|
protected mixed | $submittedBy |
|
line 104 |
Method Details | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 665 addErrorpublic void addError (string $message) Adds error message to the list.
|
|||||||||||||||
line 261 addGrouppublic FormGroup addGroup ([string $caption = Adds fieldset group to the form.
|
|||||||||||||||
line 239 addProtectionpublic void addProtection ([string $message = Cross-Site Request Forgery (CSRF) form protection.
|
|||||||||||||||
line 226 addTrackerpublic HiddenField addTracker (string $name) Adds distinguishing mark. Overridden in child classes as:
|
|||||||||||||||
line 155 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 699 cleanErrorspublic void cleanErrors ()
|
|||||||||||||||
line 191 getActionpublic mixed getAction () Returns form's action.
|
|||||||||||||||
line 715 getElementPrototypepublic Html getElementPrototype () Returns form's HTML element template.
|
|||||||||||||||
line 349 getEncodingpublic string getEncoding () Returns the encoding.
|
|||||||||||||||
line 679 getErrorspublic array getErrors () Returns validation errors.
|
|||||||||||||||
line 168 getFormpublic Form getForm ([$need = Returns self.
|
|||||||||||||||
line 323 getGrouppublic FormGroup getGroup (string $name) Returns the specified group.
|
|||||||||||||||
line 311 getGroupspublic array getGroups () Returns all defined groups.
|
|||||||||||||||
line 800 getHttpRequestprotected IHttpRequest getHttpRequest ()
|
|||||||||||||||
line 214 getMethodpublic string getMethod () Returns form's method.
|
|||||||||||||||
line 738 getRendererpublic IFormRenderer|NULL getRenderer () Returns form renderer.
|
|||||||||||||||
line 810 getSessionprotected Session getSession ()
|
|||||||||||||||
line 376 getTranslatorpublic ITranslator|NULL getTranslator () Returns translate adapter.
|
|||||||||||||||
line 592 getValuespublic array getValues () Returns the values submitted by the form.
|
|||||||||||||||
line 689 hasErrorspublic bool hasErrors ()
|
|||||||||||||||
line 537 isPopulatedpublic bool isPopulated () Was form populated by setDefaults() or processHttpRequest() yet?
|
|||||||||||||||
line 391 isSubmittedpublic ISubmitterControl|FALSE isSubmitted () Tells if the form was submitted.
|
|||||||||||||||
line 628 isValidpublic bool isValid () Is form valid?
|
|||||||||||||||
line 504 loadHttpDataprotected void loadHttpData ($data) Fill-in the form with HTTP data. Doesn't check if form was submitted.
|
|||||||||||||||
line 419 processHttpRequestpublic void processHttpRequest ([IHttpRequest $httpRequest = Detects form submission and loads HTTP values. Overridden in child classes as:
|
|||||||||||||||
line 135 __constructpublic Form __construct ([$name = Form constructor. Overridden in child classes as:
|
|||||||||||||||
line 285 removeGrouppublic void removeGroup (string|FormGroup $name) Removes fieldset group from form.
|
|||||||||||||||
line 752 renderpublic void render () Renders form.
|
|||||||||||||||
line 180 setActionpublic void setAction (mixed $url) Sets form's action.
|
|||||||||||||||
line 490 setDefaultspublic void setDefaults (array|Traversable $values, [bool $erase = Fill-in with default values.
|
|||||||||||||||
line 335 setEncodingpublic void setEncoding (string $value) Set the encoding for the values.
|
|||||||||||||||
line 203 setMethodpublic void setMethod (string $method) Sets form's method.
|
|||||||||||||||
line 727 setRendererpublic void setRenderer (IFormRenderer $renderer) Sets form renderer.
|
|||||||||||||||
line 407 setSubmittedBypublic void setSubmittedBy ([ISubmitterControl $by = Sets the submittor control.
|
|||||||||||||||
line 365 setTranslatorpublic void setTranslator ([$translator = Sets translate adapter.
|
|||||||||||||||
line 550 setValuespublic void setValues (array|Traversable $values, [bool $erase = Fill-in with values.
|
|||||||||||||||
line 456 submitprotected void submit () Fires submit/click events.
|
|||||||||||||||
line 642 validatepublic void validate () Performs the server side validation.
|
|||||||||||||||
line 772 __toStringpublic bool __toString () Renders form to string.
|