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
()
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 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 452 addConditionpublic Rules addCondition (mixed $operation, [mixed $value = Adds a validation condition a returns new branch.
|
||||||||||||||||||
line 466 addConditionOnpublic Rules addConditionOn (IFormControl $control, mixed $operation, [mixed $value = Adds a validation condition based on another control a returns new branch.
|
||||||||||||||||||
line 578 addErrorpublic void addError (string $message) Adds error message to the list.
|
||||||||||||||||||
line 438 addRulepublic FormControl addRule (mixed $operation, [string $message = Adds a validation rule.
|
||||||||||||||||||
line 612 cleanErrorspublic void cleanErrors ()
|
||||||||||||||||||
line 349 getControlpublic Html getControl () Generates control's HTML element. Overridden in child classes as:
|
||||||||||||||||||
line 383 getControlPrototypepublic Html getControlPrototype () Returns control's HTML element template.
|
||||||||||||||||||
line 592 getErrorspublic array getErrors () Returns errors corresponding to control. Implementation of:
|
||||||||||||||||||
line 126 getFormpublic Form getForm ([bool $need = Returns form.
|
||||||||||||||||||
line 171 getHtmlIdpublic string getHtmlId () Returns control's HTML id.
|
||||||||||||||||||
line 137 getHtmlNamepublic string getHtmlName () Returns name of control within a Form & INamingContainer scope. Overridden in child classes as:
|
||||||||||||||||||
line 365 getLabelpublic Html getLabel () Generates label's HTML element. Overridden in child classes as:
|
||||||||||||||||||
line 394 getLabelPrototypepublic Html getLabelPrototype () Returns label's HTML element template.
|
||||||||||||||||||
line 216 getOptionpublic mixed getOption (string $key, [mixed $default = Returns user-specific option.
|
||||||||||||||||||
line 227 getOptionspublic array getOptions () Returns user-specific options.
|
||||||||||||||||||
line 476 getRulespublic Rules getRules () Implementation of:
|
||||||||||||||||||
line 254 getTranslatorpublic ITranslator|NULL getTranslator () Returns translate adapter.
|
||||||||||||||||||
line 297 getValuepublic mixed getValue () Returns control's value. Overridden in child classes as: Implementation of:
|
||||||||||||||||||
line 602 hasErrorspublic bool hasErrors ()
|
||||||||||||||||||
line 334 isDisabledpublic bool isDisabled () Is control disabled? Implementation of:
|
||||||||||||||||||
line 420 isRenderedpublic bool isRendered () Does method getControl() have been called?
|
||||||||||||||||||
line 502 isRequiredpublic bool isRequired () Is control mandatory?
|
||||||||||||||||||
line 309 loadHttpDatapublic void loadHttpData (array $data) Loads HTTP data. Overridden in child classes as: Implementation of:
|
||||||||||||||||||
line 514 notifyRulepublic void notifyRule (Rule $rule) New rule or condition notification callback. Overridden in child classes as:
|
||||||||||||||||||
line 322 setDisabledpublic FormControl setDisabled ([bool $value = Disables or enables control.
|
||||||||||||||||||
line 160 setHtmlIdpublic void setHtmlId (string $id) Changes control's HTML id.
|
||||||||||||||||||
line 197 setOptionpublic FormControl setOption (string $key, mixed $value) Sets user-specific option. Common options:
|
||||||||||||||||||
line 111 setParentpublic void setParent ([$parent = Overloaded parent setter. This method checks for invalid control name.
|
||||||||||||||||||
line 407 setRenderedpublic FormControl setRendered ([bool $value = Sets 'rendered' indicator.
|
||||||||||||||||||
line 489 setRequiredpublic FormControl setRequired ([string $message = Makes control mandatory.
|
||||||||||||||||||
line 243 setTranslatorpublic void setTranslator ([$translator = Sets translate adapter.
|
||||||||||||||||||
line 286 setValuepublic void setValue (mixed $value) Sets control's value. Overridden in child classes as: Implementation of:
|
||||||||||||||||||
line 269 translatepublic string translate (string $s) Returns translated string. Implementation of:
|
||||||||||||||||||
line 533 validateEqualpublic static bool validateEqual (IFormControl $control, mixed $arg) Equal validator: are control's value and second parameter equal?
|
||||||||||||||||||
line 554 validateFilledpublic static bool validateFilled (IFormControl $control) Filled validator: is control filled? Overridden in child classes as:
|
||||||||||||||||||
line 566 validateValidpublic static bool validateValid (IFormControl $control) Valid validator: is control valid?
|