Class NFormControl
Base class that implements the basic functionality common to form controls.
NObject | --NComponent | --NFormControl
Implements interfaces:
Direct Known Sub-classes:
Public Method Summary | |
---|---|
NFormControl |
__construct
([string $caption =
NULL ])
|
NRules |
addCondition
(mixed $operation, [mixed $value =
NULL ])
Adds a validation condition a returns new branch.
|
NRules |
Adds a validation condition based on another control a returns new branch.
|
void |
addError
(string $message)
Adds error message to the list.
|
NFormControl |
Adds a validation rule.
|
void |
cleanErrors
()
|
NHtml |
getControl
()
Generates control's HTML element.
|
NHtml |
Returns control's HTML element template.
|
array |
getErrors
()
Returns errors corresponding to control.
|
NForm |
getForm
([bool $need =
TRUE ])
Returns form.
|
string |
getHtmlId
()
Returns control's HTML id.
|
string |
getHtmlName
()
Returns name of control within a NForm & INamingContainer scope.
|
NHtml |
getLabel
([string $caption =
NULL ])
Generates label's HTML element.
|
NHtml |
Returns label's HTML element template.
|
mixed |
getOption
(string $key, [mixed $default =
NULL ])
Returns user-specific option.
|
array |
getOptions
()
Returns user-specific options.
|
NRules |
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
(NRule $rule)
New rule or condition notification callback.
|
NFormControl |
setDefaultValue
(mixed $value)
Sets control's default value.
|
NFormControl |
setDisabled
([bool $value =
TRUE ])
Disables or enables control.
|
NFormControl |
setHtmlId
(string $id)
Changes control's HTML id.
|
NFormControl |
setOption
(string $key, mixed $value)
Sets user-specific option.
|
NFormControl |
Overloaded parent setter. This method checks for invalid control name.
|
NFormControl |
setRendered
([bool $value =
TRUE ])
Sets 'rendered' indicator.
|
NFormControl |
setRequired
([string $message =
NULL ])
Makes control mandatory.
|
NFormControl |
setTranslator
([$translator =
NULL ])
Sets translate adapter.
|
NFormControl |
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 NForm.
|
Methods Inherited From NComponent |
---|
__construct(), attached(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), setParent(), unmonitor(), validateParent(), __clone(), __wakeup() |
Methods Inherited From NObject |
---|
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset() |
Variable Summary | ||||
---|---|---|---|---|
string | $caption |
|
line 57 textual caption or label |
|
protected NHtml | $control |
|
line 63 control element template |
|
static string | $idMask | 'frm%s-%s' |
line 54 |
|
protected NHtml | $label |
|
line 66 label element template |
|
protected mixed | $value |
|
line 60 unfiltered control value |
Method Details | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 94 __constructpublic NFormControl __construct ([string $caption = Overridden in child classes as:
|
||||||||||||||||||
line 491 addConditionpublic NRules addCondition (mixed $operation, [mixed $value = Adds a validation condition a returns new branch.
|
||||||||||||||||||
line 505 addConditionOnpublic NRules 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 NFormControl 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 NForm. Overridden in child classes as:
|
||||||||||||||||||
line 651 cleanErrorspublic void cleanErrors ()
|
||||||||||||||||||
line 383 getControlpublic NHtml getControl () Generates control's HTML element. Overridden in child classes as:
|
||||||||||||||||||
line 422 getControlPrototypepublic NHtml getControlPrototype () Returns control's HTML element template.
|
||||||||||||||||||
line 631 getErrorspublic array getErrors () Returns errors corresponding to control. Implementation of:
|
||||||||||||||||||
line 142 getFormpublic NForm 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 NForm & INamingContainer scope. Overridden in child classes as:
|
||||||||||||||||||
line 400 getLabelpublic NHtml getLabel ([string $caption = Generates label's HTML element. Overridden in child classes as:
|
||||||||||||||||||
line 433 getLabelPrototypepublic NHtml 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 NRules 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 (NRule $rule) New rule or condition notification callback. Overridden in child classes as:
|
||||||||||||||||||
line 328 setDefaultValuepublic NFormControl setDefaultValue (mixed $value) Sets control's default value.
|
||||||||||||||||||
line 356 setDisabledpublic NFormControl setDisabled ([bool $value = Disables or enables control.
|
||||||||||||||||||
line 176 setHtmlIdpublic NFormControl setHtmlId (string $id) Changes control's HTML id.
|
||||||||||||||||||
line 214 setOptionpublic NFormControl setOption (string $key, mixed $value) Sets user-specific option. Common options:
|
||||||||||||||||||
line 127 setParentpublic NFormControl setParent ([$parent = Overloaded parent setter. This method checks for invalid control name.
|
||||||||||||||||||
line 446 setRenderedpublic NFormControl setRendered ([bool $value = Sets 'rendered' indicator.
|
||||||||||||||||||
line 528 setRequiredpublic NFormControl setRequired ([string $message = Makes control mandatory.
|
||||||||||||||||||
line 260 setTranslatorpublic NFormControl setTranslator ([$translator = Sets translate adapter.
|
||||||||||||||||||
line 304 setValuepublic NFormControl 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?
|