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 $label)
|
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.
|
FormContainer |
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
()
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
(array $data)
Loads HTTP data.
|
void |
notifyRule
(Rule $rule)
New rule or condition notification callback.
|
FormControl |
setDisabled
([bool $value =
TRUE ])
Disables or enables control.
|
void |
setHtmlId
(string $id)
Changes control's HTML id.
|
FormControl |
setOption
(string $key, mixed $value)
Sets user-specific option.
|
void |
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.
|
void |
setTranslator
([$translator =
NULL ])
Sets translate adapter.
|
void |
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?
|
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() |
Variable Summary | ||||
---|---|---|---|---|
string | $caption |
|
line 42 textual caption or label |
|
protected Html | $control |
|
line 48 control element template |
|
static string | $idMask | 'frm%s-%s' |
line 39 |
|
protected Html | $label |
|
line 51 label element template |
|
protected mixed | $value |
|
line 45 unfiltered control value |
Method Details | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 79 __constructpublic FormControl __construct (string $label) Overridden in child classes as:
|
||||||||||||||||||
line 438 addConditionpublic Rules addCondition (mixed $operation, [mixed $value = Adds a validation condition a returns new branch.
|
||||||||||||||||||
line 452 addConditionOnpublic Rules addConditionOn (IFormControl $control, mixed $operation, [mixed $value = Adds a validation condition based on another control a returns new branch.
|
||||||||||||||||||
line 564 addErrorpublic void addError (string $message) Adds error message to the list.
|
||||||||||||||||||
line 424 addRulepublic FormContainer addRule (mixed $operation, [string $message = Adds a validation rule.
|
||||||||||||||||||
line 598 cleanErrorspublic void cleanErrors ()
|
||||||||||||||||||
line 334 getControlpublic Html getControl () Generates control's HTML element. Overridden in child classes as:
|
||||||||||||||||||
line 369 getControlPrototypepublic Html getControlPrototype () Returns control's HTML element template.
|
||||||||||||||||||
line 578 getErrorspublic array getErrors () Returns errors corresponding to control. Implementation of:
|
||||||||||||||||||
line 111 getFormpublic Form getForm ([bool $need = Returns form.
|
||||||||||||||||||
line 156 getHtmlIdpublic string getHtmlId () Returns control's HTML id.
|
||||||||||||||||||
line 122 getHtmlNamepublic string getHtmlName () Returns name of control within a Form & INamingContainer scope.
|
||||||||||||||||||
line 350 getLabelpublic Html getLabel () Generates label's HTML element. Overridden in child classes as:
|
||||||||||||||||||
line 380 getLabelPrototypepublic Html getLabelPrototype () Returns label's HTML element template.
|
||||||||||||||||||
line 201 getOptionpublic mixed getOption (string $key, [mixed $default = Returns user-specific option.
|
||||||||||||||||||
line 212 getOptionspublic array getOptions () Returns user-specific options.
|
||||||||||||||||||
line 462 getRulespublic Rules getRules () Implementation of:
|
||||||||||||||||||
line 239 getTranslatorpublic ITranslator|NULL getTranslator () Returns translate adapter.
|
||||||||||||||||||
line 282 getValuepublic mixed getValue () Returns control's value. Overridden in child classes as: Implementation of:
|
||||||||||||||||||
line 588 hasErrorspublic bool hasErrors ()
|
||||||||||||||||||
line 319 isDisabledpublic bool isDisabled () Is control disabled? Implementation of:
|
||||||||||||||||||
line 406 isRenderedpublic bool isRendered () Does method getControl() have been called?
|
||||||||||||||||||
line 488 isRequiredpublic bool isRequired () Is control mandatory?
|
||||||||||||||||||
line 294 loadHttpDatapublic void loadHttpData (array $data) Loads HTTP data. Overridden in child classes as: Implementation of:
|
||||||||||||||||||
line 500 notifyRulepublic void notifyRule (Rule $rule) New rule or condition notification callback. Overridden in child classes as:
|
||||||||||||||||||
line 307 setDisabledpublic FormControl setDisabled ([bool $value = Disables or enables control.
|
||||||||||||||||||
line 145 setHtmlIdpublic void setHtmlId (string $id) Changes control's HTML id.
|
||||||||||||||||||
line 182 setOptionpublic FormControl setOption (string $key, mixed $value) Sets user-specific option. Common options:
|
||||||||||||||||||
line 96 setParentpublic void setParent ([$parent = Overloaded parent setter. This method checks for invalid control name.
|
||||||||||||||||||
line 393 setRenderedpublic FormControl setRendered ([bool $value = Sets 'rendered' indicator.
|
||||||||||||||||||
line 475 setRequiredpublic FormControl setRequired ([string $message = Makes control mandatory.
|
||||||||||||||||||
line 228 setTranslatorpublic void setTranslator ([$translator = Sets translate adapter.
|
||||||||||||||||||
line 271 setValuepublic void setValue (mixed $value) Sets control's value. Overridden in child classes as: Implementation of:
|
||||||||||||||||||
line 254 translatepublic string translate (string $s) Returns translated string. Implementation of:
|
||||||||||||||||||
line 519 validateEqualpublic static bool validateEqual (IFormControl $control, mixed $arg) Equal validator: are control's value and second parameter equal?
|
||||||||||||||||||
line 540 validateFilledpublic static bool validateFilled (IFormControl $control) Filled validator: is control filled? Overridden in child classes as:
|
||||||||||||||||||
line 552 validateValidpublic static bool validateValid (IFormControl $control) Valid validator: is control valid?
|