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
()
|
Form |
Form constructor.
|
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.
|
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 57 operation name |
string | EQUAL |
':equal' |
line 45 operation name |
string | FILLED |
':filled' |
line 47 operation name |
string | FLOAT |
':float' |
line 62 operation name |
string | INTEGER |
':integer' |
line 60 operation name |
string | IS_IN |
':equal' |
line 46 operation name |
string | LENGTH |
':length' |
line 56 operation name |
string | MAX_FILE_SIZE |
':fileSize' |
line 66 operation name |
string | MAX_LENGTH |
':maxLength' |
line 55 operation name |
string | MIME_TYPE |
':mimeType' |
line 67 operation name |
string | MIN_LENGTH |
':minLength' |
line 54 operation name |
string | NUMERIC |
':integer' |
line 61 operation name |
string | PROTECTOR_ID |
'_token_' |
line 77 protection token ID |
string | RANGE |
':range' |
line 63 operation name |
string | REGEXP |
':regexp' |
line 59 operation name |
string | SCRIPT |
'Nette\Forms\InstantClientScript::javascript' |
line 70 operation name |
string | SUBMITTED |
':submitted' |
line 51 operation name |
string | TRACKER_ID |
'_form_' |
line 74 tracker ID |
string | URL |
':url' |
line 58 operation name |
string | VALID |
':valid' |
line 48 operation name |
Variable Summary | ||||
---|---|---|---|---|
array | $onInvalidSubmit |
|
line 83 of event handlers; Occurs when the form is submitted and not validated; function(Form $sender) |
|
array | $onSubmit |
|
line 80 of event handlers; Occurs when the form is submitted and successfully validated; function(Form $sender) |
|
protected mixed | $submittedBy |
|
line 86 |
Method Details | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 617 addErrorpublic void addError (string $message) Adds error message to the list.
|
|||||||||||||||
line 240 addGrouppublic FormGroup addGroup ([string $label = Adds fieldset group to the form.
|
|||||||||||||||
line 218 addProtectionpublic void addProtection ([string $message = Cross-Site Request Forgery (CSRF) form protection.
|
|||||||||||||||
line 205 addTrackerpublic HiddenField addTracker (string $name) Adds distinguishing mark.
|
|||||||||||||||
line 134 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 651 cleanErrorspublic void cleanErrors ()
|
|||||||||||||||
line 117 __constructpublic Form __construct ([$name = Form constructor. Overridden in child classes as:
|
|||||||||||||||
line 170 getActionpublic mixed getAction () Returns form's action.
|
|||||||||||||||
line 667 getElementPrototypepublic Html getElementPrototype () Returns form's HTML element template.
|
|||||||||||||||
line 301 getEncodingpublic string getEncoding () Returns the encoding.
|
|||||||||||||||
line 631 getErrorspublic array getErrors () Returns validation errors.
|
|||||||||||||||
line 147 getFormpublic Form getForm ([$need = Returns self.
|
|||||||||||||||
line 275 getGrouppublic FormGroup getGroup (string $name) Returns the specified group.
|
|||||||||||||||
line 263 getGroupspublic array getGroups () Returns all defined groups.
|
|||||||||||||||
line 752 getHttpRequestprotected IHttpRequest getHttpRequest ()
|
|||||||||||||||
line 193 getMethodpublic string getMethod () Returns form's method.
|
|||||||||||||||
line 690 getRendererpublic IFormRenderer|NULL getRenderer () Returns form renderer.
|
|||||||||||||||
line 762 getSessionprotected Session getSession ()
|
|||||||||||||||
line 328 getTranslatorpublic ITranslator|NULL getTranslator () Returns translate adapter.
|
|||||||||||||||
line 544 getValuespublic array getValues () Returns the values submitted by the form.
|
|||||||||||||||
line 641 hasErrorspublic bool hasErrors ()
|
|||||||||||||||
line 489 isPopulatedpublic bool isPopulated () Was form populated by setDefaults() or processHttpRequest() yet?
|
|||||||||||||||
line 343 isSubmittedpublic ISubmitterControl|FALSE isSubmitted () Tells if the form was submitted.
|
|||||||||||||||
line 580 isValidpublic bool isValid () Is form valid?
|
|||||||||||||||
line 456 loadHttpDataprotected void loadHttpData ($data) Fill-in the form with HTTP data. Doesn't check if form was submitted.
|
|||||||||||||||
line 371 processHttpRequestpublic void processHttpRequest ([IHttpRequest $httpRequest = Detects form submission and loads HTTP values. Overridden in child classes as:
|
|||||||||||||||
line 704 renderpublic void render () Renders form.
|
|||||||||||||||
line 159 setActionpublic void setAction (mixed $url) Sets form's action.
|
|||||||||||||||
line 442 setDefaultspublic void setDefaults (array|Traversable $values, [bool $erase = Fill-in with default values.
|
|||||||||||||||
line 287 setEncodingpublic void setEncoding (string $value) Set the encoding for the values.
|
|||||||||||||||
line 182 setMethodpublic void setMethod (string $method) Sets form's method.
|
|||||||||||||||
line 679 setRendererpublic void setRenderer (IFormRenderer $renderer) Sets form renderer.
|
|||||||||||||||
line 359 setSubmittedBypublic void setSubmittedBy ([ISubmitterControl $by = Sets the submittor control.
|
|||||||||||||||
line 317 setTranslatorpublic void setTranslator ([$translator = Sets translate adapter.
|
|||||||||||||||
line 502 setValuespublic void setValues (array|Traversable $values, [bool $erase = Fill-in with values.
|
|||||||||||||||
line 408 submitprotected void submit () Fires submit/click events.
|
|||||||||||||||
line 594 validatepublic void validate () Performs the server side validation.
|
|||||||||||||||
line 724 __toStringpublic bool __toString () Renders form to string.
|