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 |
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, [int $count =
NULL ])
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 43 textual caption or label |
|
protected Html | $control |
|
line 49 control element template |
|
static string | $idMask | 'frm%s-%s' |
line 40 |
|
protected Html | $label |
|
line 52 label element template |
|
protected mixed | $value |
|
line 46 unfiltered control value |
Method Details | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 80 __constructpublic FormControl __construct ([string $caption = Overridden in child classes as:
|
||||||||||||||||||
line 466 addConditionpublic Rules addCondition (mixed $operation, [mixed $value = Adds a validation condition a returns new branch.
|
||||||||||||||||||
line 480 addConditionOnpublic Rules addConditionOn (IFormControl $control, mixed $operation, [mixed $value = Adds a validation condition based on another control a returns new branch.
|
||||||||||||||||||
line 591 addErrorpublic void addError (string $message) Adds error message to the list.
|
||||||||||||||||||
line 452 addRulepublic FormControl addRule (mixed $operation, [string $message = Adds a validation rule.
|
||||||||||||||||||
line 97 attachedprotected void attached (IComponent $form) This method will be called when the component becomes attached to Form. Overridden in child classes as:
|
||||||||||||||||||
line 625 cleanErrorspublic void cleanErrors ()
|
||||||||||||||||||
line 358 getControlpublic Html getControl () Generates control's HTML element. Overridden in child classes as:
|
||||||||||||||||||
line 397 getControlPrototypepublic Html getControlPrototype () Returns control's HTML element template.
|
||||||||||||||||||
line 605 getErrorspublic array getErrors () Returns errors corresponding to control. Implementation of:
|
||||||||||||||||||
line 112 getFormpublic Form getForm ([bool $need = Returns form.
|
||||||||||||||||||
line 162 getHtmlIdpublic string getHtmlId () Returns control's HTML id.
|
||||||||||||||||||
line 123 getHtmlNamepublic string getHtmlName () Returns name of control within a Form & INamingContainer scope. Overridden in child classes as:
|
||||||||||||||||||
line 375 getLabelpublic Html getLabel ([string $caption = Generates label's HTML element. Overridden in child classes as:
|
||||||||||||||||||
line 408 getLabelPrototypepublic Html getLabelPrototype () Returns label's HTML element template.
|
||||||||||||||||||
line 207 getOptionpublic mixed getOption (string $key, [mixed $default = Returns user-specific option.
|
||||||||||||||||||
line 218 getOptionspublic array getOptions () Returns user-specific options.
|
||||||||||||||||||
line 490 getRulespublic Rules getRules () Implementation of:
|
||||||||||||||||||
line 246 getTranslatorpublic ITranslator|NULL getTranslator () Returns translate adapter.
|
||||||||||||||||||
line 291 getValuepublic mixed getValue () Returns control's value. Overridden in child classes as: Implementation of:
|
||||||||||||||||||
line 615 hasErrorspublic bool hasErrors ()
|
||||||||||||||||||
line 343 isDisabledpublic bool isDisabled () Is control disabled? Implementation of:
|
||||||||||||||||||
line 434 isRenderedpublic bool isRendered () Does method getControl() have been called?
|
||||||||||||||||||
line 516 isRequiredpublic bool isRequired () Is control mandatory?
|
||||||||||||||||||
line 318 loadHttpDatapublic void loadHttpData () Loads HTTP data. Overridden in child classes as: Implementation of:
|
||||||||||||||||||
line 528 notifyRulepublic void notifyRule (Rule $rule) New rule or condition notification callback. Overridden in child classes as:
|
||||||||||||||||||
line 303 setDefaultValuepublic FormControl setDefaultValue (mixed $value) Sets control's default value.
|
||||||||||||||||||
line 331 setDisabledpublic FormControl setDisabled ([bool $value = Disables or enables control.
|
||||||||||||||||||
line 150 setHtmlIdpublic FormControl setHtmlId (string $id) Changes control's HTML id.
|
||||||||||||||||||
line 188 setOptionpublic FormControl setOption (string $key, mixed $value) Sets user-specific option. Common options:
|
||||||||||||||||||
line 421 setRenderedpublic FormControl setRendered ([bool $value = Sets 'rendered' indicator.
|
||||||||||||||||||
line 503 setRequiredpublic FormControl setRequired ([string $message = Makes control mandatory.
|
||||||||||||||||||
line 234 setTranslatorpublic FormControl setTranslator ([$translator = Sets translate adapter.
|
||||||||||||||||||
line 279 setValuepublic FormControl setValue (mixed $value) Sets control's value. Overridden in child classes as: Implementation of:
|
||||||||||||||||||
line 262 translatepublic string translate (string $s, [int $count = Returns translated string. Implementation of:
|
||||||||||||||||||
line 547 validateEqualpublic static bool validateEqual (IFormControl $control, mixed $arg) Equal validator: are control's value and second parameter equal?
|
||||||||||||||||||
line 567 validateFilledpublic static bool validateFilled (IFormControl $control) Filled validator: is control filled? Overridden in child classes as:
|
||||||||||||||||||
line 579 validateValidpublic static bool validateValid (IFormControl $control) Valid validator: is control valid?
|