Class FormControl (namespace Nette\Forms)
Base class that implements the basic functionality common to form controls.
Implements interfaces:
Direct Known Sub-classes:
Public Method Summary | |
---|---|
FormControl |
__construct
([string $caption =
NULL ])
|
Rules |
addCondition
(mixed $operation, [mixed $value =
NULL ])
Adds a validation condition a returns new branch.
|
Rules |
Adds a validation condition based on another control a returns new branch.
|
void |
addError
(string $message)
Adds error message to the list.
|
FormControl |
Adds a validation rule.
|
void |
cleanErrors
()
|
Html |
getControl
()
Generates control's HTML element.
|
Html |
Returns control's HTML element template.
|
array |
getErrors
()
Returns errors corresponding to control.
|
Form |
getForm
([bool $need =
TRUE ])
Returns form.
|
string |
getHtmlId
()
Returns control's HTML id.
|
string |
getHtmlName
()
Returns name of control within a Form & INamingContainer scope.
|
Html |
getLabel
([string $caption =
NULL ])
Generates label's HTML element.
|
Html |
Returns label's HTML element template.
|
mixed |
getOption
(string $key, [mixed $default =
NULL ])
Returns user-specific option.
|
array |
getOptions
()
Returns user-specific options.
|
Rules |
getRules
()
|
ITranslator|NULL |
Returns translate adapter.
|
mixed |
getValue
()
Returns control's value.
|
bool |
hasErrors
()
|
bool |
isDisabled
()
Is control disabled?
|
bool |
isRendered
()
Does method getControl() have been called?
|
bool |
isRequired
()
Is control mandatory?
|
void |
loadHttpData
()
Loads HTTP data.
|
void |
notifyRule
(Rule $rule)
New rule or condition notification callback.
|
FormControl |
setDefaultValue
(mixed $value)
Sets control's default value.
|
FormControl |
setDisabled
([bool $value =
TRUE ])
Disables or enables control.
|
FormControl |
setHtmlId
(string $id)
Changes control's HTML id.
|
FormControl |
setOption
(string $key, mixed $value)
Sets user-specific option.
|
FormControl |
Overloaded parent setter. This method checks for invalid control name.
|
FormControl |
setRendered
([bool $value =
TRUE ])
Sets 'rendered' indicator.
|
FormControl |
setRequired
([string $message =
NULL ])
Makes control mandatory.
|
FormControl |
setTranslator
([$translator =
NULL ])
Sets translate adapter.
|
FormControl |
setValue
(mixed $value)
Sets control's value.
|
string |
translate
(string $s)
Returns translated string.
|
static bool |
validateEqual
(IFormControl $control, mixed $arg)
Equal validator: are control's value and second parameter equal?
|
static bool |
validateFilled
(IFormControl $control)
Filled validator: is control filled?
|
static bool |
validateValid
(IFormControl $control)
Valid validator: is control valid?
|
Protected Method Summary | |
---|---|
protected void |
attached
(IComponent $form)
This method will be called when the component becomes attached to Form.
|
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() |
Variable Summary | ||||
---|---|---|---|---|
string | $caption |
|
line 57 textual caption or label |
|
protected Html | $control |
|
line 63 control element template |
|
static string | $idMask | 'frm%s-%s' |
line 54 |
|
protected Html | $label |
|
line 66 label element template |
|
protected mixed | $value |
|
line 60 unfiltered control value |
Method Details | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 94 __constructpublic FormControl __construct ([string $caption = Overridden in child classes as:
|
||||||||||||||||||
line 491 addConditionpublic Rules addCondition (mixed $operation, [mixed $value = Adds a validation condition a returns new branch.
|
||||||||||||||||||
line 505 addConditionOnpublic Rules addConditionOn (IFormControl $control, mixed $operation, [mixed $value = Adds a validation condition based on another control a returns new branch.
|
||||||||||||||||||
line 617 addErrorpublic void addError (string $message) Adds error message to the list.
|
||||||||||||||||||
line 477 addRulepublic FormControl addRule (mixed $operation, [string $message = Adds a validation rule.
|
||||||||||||||||||
line 111 attachedprotected void attached (IComponent $form) This method will be called when the component becomes attached to Form. Overridden in child classes as:
|
||||||||||||||||||
line 651 cleanErrorspublic void cleanErrors ()
|
||||||||||||||||||
line 383 getControlpublic Html getControl () Generates control's HTML element. Overridden in child classes as:
|
||||||||||||||||||
line 422 getControlPrototypepublic Html getControlPrototype () Returns control's HTML element template.
|
||||||||||||||||||
line 631 getErrorspublic array getErrors () Returns errors corresponding to control. Implementation of:
|
||||||||||||||||||
line 142 getFormpublic Form getForm ([bool $need = Returns form.
|
||||||||||||||||||
line 188 getHtmlIdpublic string getHtmlId () Returns control's HTML id.
|
||||||||||||||||||
line 153 getHtmlNamepublic string getHtmlName () Returns name of control within a Form & INamingContainer scope. Overridden in child classes as:
|
||||||||||||||||||
line 400 getLabelpublic Html getLabel ([string $caption = Generates label's HTML element. Overridden in child classes as:
|
||||||||||||||||||
line 433 getLabelPrototypepublic Html getLabelPrototype () Returns label's HTML element template.
|
||||||||||||||||||
line 233 getOptionpublic mixed getOption (string $key, [mixed $default = Returns user-specific option.
|
||||||||||||||||||
line 244 getOptionspublic array getOptions () Returns user-specific options.
|
||||||||||||||||||
line 515 getRulespublic Rules getRules () Implementation of:
|
||||||||||||||||||
line 272 getTranslatorpublic ITranslator|NULL getTranslator () Returns translate adapter.
|
||||||||||||||||||
line 316 getValuepublic mixed getValue () Returns control's value. Overridden in child classes as: Implementation of:
|
||||||||||||||||||
line 641 hasErrorspublic bool hasErrors ()
|
||||||||||||||||||
line 368 isDisabledpublic bool isDisabled () Is control disabled? Implementation of:
|
||||||||||||||||||
line 459 isRenderedpublic bool isRendered () Does method getControl() have been called?
|
||||||||||||||||||
line 541 isRequiredpublic bool isRequired () Is control mandatory?
|
||||||||||||||||||
line 343 loadHttpDatapublic void loadHttpData () Loads HTTP data. Overridden in child classes as: Implementation of:
|
||||||||||||||||||
line 553 notifyRulepublic void notifyRule (Rule $rule) New rule or condition notification callback. Overridden in child classes as:
|
||||||||||||||||||
line 328 setDefaultValuepublic FormControl setDefaultValue (mixed $value) Sets control's default value.
|
||||||||||||||||||
line 356 setDisabledpublic FormControl setDisabled ([bool $value = Disables or enables control.
|
||||||||||||||||||
line 176 setHtmlIdpublic FormControl setHtmlId (string $id) Changes control's HTML id.
|
||||||||||||||||||
line 214 setOptionpublic FormControl setOption (string $key, mixed $value) Sets user-specific option. Common options:
|
||||||||||||||||||
line 127 setParentpublic FormControl setParent ([$parent = Overloaded parent setter. This method checks for invalid control name.
|
||||||||||||||||||
line 446 setRenderedpublic FormControl setRendered ([bool $value = Sets 'rendered' indicator.
|
||||||||||||||||||
line 528 setRequiredpublic FormControl setRequired ([string $message = Makes control mandatory.
|
||||||||||||||||||
line 260 setTranslatorpublic FormControl setTranslator ([$translator = Sets translate adapter.
|
||||||||||||||||||
line 304 setValuepublic FormControl setValue (mixed $value) Sets control's value. Overridden in child classes as: Implementation of:
|
||||||||||||||||||
line 287 translatepublic string translate (string $s) Returns translated string. Implementation of:
|
||||||||||||||||||
line 572 validateEqualpublic static bool validateEqual (IFormControl $control, mixed $arg) Equal validator: are control's value and second parameter equal?
|
||||||||||||||||||
line 593 validateFilledpublic static bool validateFilled (IFormControl $control) Filled validator: is control filled? Overridden in child classes as:
|
||||||||||||||||||
line 605 validateValidpublic static bool validateValid (IFormControl $control) Valid validator: is control valid?
|