namespace Nette\Forms
Class FormControl
Base class that implements the basic functionality common to form controls.
- Nette\Object
-
Nette\Component implements Nette\IComponent
-
Nette\Forms\FormControl implements IFormControl
public
|
#
__construct(
string
$caption = NULL
)
Parameters$caption string caption |
protected
void
|
#
attached(
IComponent
$form
)
This method will be called when the component becomes attached to Form. This method will be called when the component becomes attached to Form. Parameters$form IComponent |
public
Form
|
#
getForm(
bool
$need = true
)
Returns form. Returns form. Parameters$need bool throw exception if form doesn't exist? |
public
string
|
#
getHtmlName(
)
Returns HTML name of control. Returns HTML name of control. |
public
FormControl
|
#
setHtmlId(
string
$id
)
Changes control's HTML id. Changes control's HTML id. Parameters$id string new ID, or FALSE or NULLReturnsFormControl provides a fluent interface
|
public
string
|
#
getHtmlId(
)
Returns control's HTML id. Returns control's HTML id. |
public
FormControl
|
#
setAttribute(
string
$name,
mixed
$value = true
)
Changes control's HTML attribute. Changes control's HTML attribute. Parameters$name string name$value mixed valueReturnsFormControl provides a fluent interface
|
public
FormControl
|
#
setOption(
string
$key,
mixed
$value
)
Sets user-specific option. Sets user-specific option. Common options:
Parameters$key string key$value mixed valueReturnsFormControl provides a fluent interface
|
final public
mixed
|
#
getOption(
string
$key,
mixed
$default = NULL
)
Returns user-specific option. Returns user-specific option. Parameters$key string key$default mixed default value |
final public
array
|
#
getOptions(
)
Returns user-specific options. Returns user-specific options. |
public
FormControl
|
#
setTranslator(
Nette\ITranslator
$translator = NULL
)
Sets translate adapter. Sets translate adapter. Parameters$translator Nette\ITranslatorReturnsFormControl provides a fluent interface
|
final public
Nette\ITranslator|NULL
|
#
getTranslator(
)
Returns translate adapter. Returns translate adapter. |
public
string
|
#
translate(
string
$s,
int
$count = NULL
)
Returns translated string. Returns translated string. Parameters$s string$count int plural countImplementation of |
public
FormControl
|
#
setValue(
mixed
$value
)
Sets control's value. Sets control's value. Parameters$value mixedReturnsFormControl provides a fluent interface
Implementation of |
public
mixed
|
#
getValue(
)
Returns control's value. |
public
FormControl
|
#
setDefaultValue(
mixed
$value
)
Sets control's default value. Sets control's default value. Parameters$value mixedReturnsFormControl provides a fluent interface
|
public
void
|
#
loadHttpData(
)
Loads HTTP data. |
public
FormControl
|
#
setDisabled(
bool
$value = true
)
Disables or enables control. Disables or enables control. Parameters$value boolReturnsFormControl provides a fluent interface
|
public
bool
|
#
isDisabled(
)
Is control disabled? |
public
Nette\Web\Html
|
#
getControl(
)
Generates control's HTML element. Generates control's HTML element. |
public
Nette\Web\Html
|
#
getLabel(
string
$caption = NULL
)
Generates label's HTML element. Generates label's HTML element. Parameters$caption string |
final public
Nette\Web\Html
|
#
getControlPrototype(
)
Returns control's HTML element template. Returns control's HTML element template. |
final public
Nette\Web\Html
|
#
getLabelPrototype(
)
Returns label's HTML element template. Returns label's HTML element template. |
public
FormControl
|
#
setRendered(
bool
$value = true
)
Sets ‚rendered‘ indicator. Sets ‚rendered‘ indicator. Parameters$value boolReturnsFormControl provides a fluent interface
|
public
bool
|
#
isRendered(
)
Does method getControl() have been called? Does method getControl() have been called? |
public
FormControl
|
#
addRule(
mixed
$operation,
string
$message = NULL,
mixed
$arg = NULL
)
Adds a validation rule. Adds a validation rule. Parameters$operation mixed rule type$message string message to display for invalid data$arg mixed optional rule argumentsReturnsFormControl provides a fluent interface
|
public
Rules
|
#
addCondition(
mixed
$operation,
mixed
$value = NULL
)
Adds a validation condition a returns new branch. Adds a validation condition a returns new branch. Parameters$operation mixed condition type$value mixed optional condition argumentsReturnsRules new branch
|
public
Rules
|
#
addConditionOn(
IFormControl
$control,
mixed
$operation,
mixed
$value = NULL
)
Adds a validation condition based on another control a returns new branch. Adds a validation condition based on another control a returns new branch. Parameters$control IFormControl form control$operation mixed condition type$value mixed optional condition argumentsReturnsRules new branch
|
final public
Rules
|
#
getRules(
)
Implementation of |
final public
FormControl
|
#
setRequired(
string
$message = NULL
)
Makes control mandatory. Makes control mandatory. Parameters$message string error messageReturnsFormControl provides a fluent interface
|
final public
bool
|
#
isRequired(
)
Is control mandatory? Is control mandatory? |
public
void
|
#
notifyRule(
Rule
$rule
)
New rule or condition notification callback. New rule or condition notification callback. Parameters$rule Rule |
public static
bool
|
#
validateEqual(
IFormControl
$control,
mixed
$arg
)
Equal validator: are control's value and second parameter equal? Equal validator: are control's value and second parameter equal? Parameters$control IFormControl$arg mixed |
public static
bool
|
#
validateFilled(
IFormControl
$control
)
Filled validator: is control filled? Filled validator: is control filled? Parameters$control IFormControl |
public static
bool
|
#
validateValid(
IFormControl
$control
)
Valid validator: is control valid? Valid validator: is control valid? Parameters$control IFormControl |
public
void
|
#
addError(
string
$message
)
Adds error message to the list. Adds error message to the list. Parameters$message string error message |
public
array
|
#
getErrors(
)
Returns errors corresponding to control. |
public
bool
|
#
hasErrors(
)
|
public
void
|
#
cleanErrors(
)
|
Methods Inherited From Nette\Component
__construct(), lookup(), lookupPath(), monitor(), unmonitor(), attached(), detached(), getName(), getParent(), setParent(), validateParent(), __clone(), __wakeup()
Methods Inherited From Nette\Object
getReflection(), __call(), __callStatic(), extensionMethod(), __get(), __set(), __isset(), __unset()
Constants Inherited From Nette\Component
NAME_SEPARATOR
static
string
|
$idMask | 'frm%s-%s' |
# |
string
|
$caption | NULL |
textual caption or label # |
protected
mixed
|
$value | NULL |
unfiltered control value # |
protected
Nette\Web\Html
|
$control | NULL |
control element template # |
protected
Nette\Web\Html
|
$label | NULL |
label element template # |