Namespaces

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Diagnostics
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
      • Diagnostics
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • PhpGenerator
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
  • NetteModule
  • none

Classes

  • BaseControl
  • Button
  • Checkbox
  • CheckboxList
  • ChoiceControl
  • CsrfProtection
  • HiddenField
  • ImageButton
  • MultiChoiceControl
  • MultiSelectBox
  • RadioList
  • SelectBox
  • SubmitButton
  • TextArea
  • TextBase
  • TextInput
  • UploadControl
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage

Class BaseControl

Base class that implements the basic functionality common to form controls.

Nette\Object
Extended by Nette\ComponentModel\Component implements Nette\ComponentModel\IComponent
Extended by Nette\Forms\Controls\BaseControl implements Nette\Forms\IControl

Direct known subclasses

Nette\Forms\Controls\Button, Nette\Forms\Controls\Checkbox, Nette\Forms\Controls\ChoiceControl, Nette\Forms\Controls\HiddenField, Nette\Forms\Controls\MultiChoiceControl, Nette\Forms\Controls\TextBase, Nette\Forms\Controls\UploadControl

Indirect known subclasses

Nette\Forms\Controls\CheckboxList, Nette\Forms\Controls\CsrfProtection, Nette\Forms\Controls\ImageButton, Nette\Forms\Controls\MultiSelectBox, Nette\Forms\Controls\RadioList, Nette\Forms\Controls\SelectBox, Nette\Forms\Controls\SubmitButton, Nette\Forms\Controls\TextArea, Nette\Forms\Controls\TextInput
Abstract
Namespace: Nette\Forms\Controls
Author: David Grudl
Located at Forms/Controls/BaseControl.php
Methods summary
public
# __construct( string $caption = NULL )

Parameters

$caption
string
caption

Overrides

Nette\ComponentModel\Component::__construct()
protected
# attached( Nette\ComponentModel\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
Nette\ComponentModel\IComponent

Overrides

Nette\ComponentModel\Component::attached()
public Nette\Forms\Form
# getForm( boolean $need = TRUE )

Returns form.

Returns form.

Parameters

$need
boolean
throw exception if form doesn't exist?

Returns

Nette\Forms\Form
public
# loadHttpData( )

Loads HTTP data.

Loads HTTP data.

public mixed
# getHttpData( $type, $htmlTail = NULL )

Loads HTTP data.

Loads HTTP data.

Returns

mixed
public string
# getHtmlName( )

Returns HTML name of control.

Returns HTML name of control.

Returns

string
public Nette\Forms\Controls\BaseControl
# setValue( mixed $value )

Sets control's value.

Sets control's value.

Parameters

$value
mixed

Returns

Nette\Forms\Controls\BaseControl

Implementation of

Nette\Forms\IControl::setValue()
public mixed
# getValue( )

Returns control's value.

Returns control's value.

Returns

mixed

Implementation of

Nette\Forms\IControl::getValue()
public boolean
# isFilled( )

Is control filled?

Is control filled?

Returns

boolean
public Nette\Forms\Controls\BaseControl
# setDefaultValue( $value )

Sets control's default value.

Sets control's default value.

Returns

Nette\Forms\Controls\BaseControl
public Nette\Forms\Controls\BaseControl
# setDisabled( boolean $value = TRUE )

Disables or enables control.

Disables or enables control.

Parameters

$value
boolean

Returns

Nette\Forms\Controls\BaseControl
public boolean
# isDisabled( )

Is control disabled?

Is control disabled?

Returns

boolean
public Nette\Forms\Controls\BaseControl
# setOmitted( boolean $value = TRUE )

Sets whether control value is excluded from $form->getValues() result.

Sets whether control value is excluded from $form->getValues() result.

Parameters

$value
boolean

Returns

Nette\Forms\Controls\BaseControl
public boolean
# isOmitted( )

Is control value excluded from $form->getValues() result?

Is control value excluded from $form->getValues() result?

Returns

boolean

Implementation of

Nette\Forms\IControl::isOmitted()
public Nette\Utils\Html|string
# getControl( )

Generates control's HTML element.

Generates control's HTML element.

Returns

Nette\Utils\Html|string
public Nette\Utils\Html|string
# getLabel( string $caption = NULL )

Generates label's HTML element.

Generates label's HTML element.

Parameters

$caption
string

Returns

Nette\Utils\Html|string
public Nette\Utils\Html
# getControlPrototype( )

Returns control's HTML element template.

Returns control's HTML element template.

Returns

Nette\Utils\Html
public Nette\Utils\Html
# getLabelPrototype( )

Returns label's HTML element template.

Returns label's HTML element template.

Returns

Nette\Utils\Html
public Nette\Forms\Controls\BaseControl
# setHtmlId( string $id )

Changes control's HTML id.

Changes control's HTML id.

Parameters

$id
string
new ID, or FALSE or NULL

Returns

Nette\Forms\Controls\BaseControl
public string
# getHtmlId( )

Returns control's HTML id.

Returns control's HTML id.

Returns

string
public Nette\Forms\Controls\BaseControl
# setAttribute( string $name, mixed $value = TRUE )

Changes control's HTML attribute.

Changes control's HTML attribute.

Parameters

$name
string
name
$value
mixed
value

Returns

Nette\Forms\Controls\BaseControl
public Nette\Forms\Controls\BaseControl
# setTranslator( Nette\Localization\ITranslator $translator = NULL )

Sets translate adapter.

Sets translate adapter.

Returns

Nette\Forms\Controls\BaseControl
public Nette\Localization\ITranslator|null
# getTranslator( )

Returns translate adapter.

Returns translate adapter.

Returns

Nette\Localization\ITranslator|null
public string
# translate( mixed $value, integer $count = NULL )

Returns translated string.

Returns translated string.

Parameters

$value
mixed
$count
integer
plural count

Returns

string

Implementation of

Nette\Forms\IControl::translate()
public Nette\Forms\Controls\BaseControl
# 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 arguments

Returns

Nette\Forms\Controls\BaseControl
public Nette\Forms\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 arguments

Returns

Nette\Forms\Rules
new branch
public Nette\Forms\Rules
# addConditionOn( Nette\Forms\IControl $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
Nette\Forms\IControl
form control
$operation
mixed
condition type
$value
mixed
optional condition arguments

Returns

Nette\Forms\Rules
new branch
public Nette\Forms\Rules
# getRules( )

Returns

Nette\Forms\Rules
public Nette\Forms\Controls\BaseControl
# setRequired( mixed $value = TRUE )

Makes control mandatory.

Makes control mandatory.

Parameters

$value
mixed
state or error message

Returns

Nette\Forms\Controls\BaseControl
public boolean
# isRequired( )

Is control mandatory?

Is control mandatory?

Returns

boolean
public
# validate( )

Performs the server side validation.

Performs the server side validation.

Implementation of

Nette\Forms\IControl::validate()
public
# addError( string $message )

Adds error message to the list.

Adds error message to the list.

Parameters

$message
string
error message
public string
# getError( )

Returns errors corresponding to control.

Returns errors corresponding to control.

Returns

string
public array
# getErrors( )

Returns errors corresponding to control.

Returns errors corresponding to control.

Returns

array

Implementation of

Nette\Forms\IControl::getErrors()
public boolean
# hasErrors( )

Returns

boolean
public
# cleanErrors( )
protected static array
# exportRules( $rules )

Returns

array
public Nette\Forms\Controls\BaseControl
# setOption( $key, $value )

Sets user-specific option.

Sets user-specific option.

Returns

Nette\Forms\Controls\BaseControl
public mixed
# getOption( $key, $default = NULL )

Returns user-specific option.

Returns user-specific option.

Returns

mixed
public array
# getOptions( )

Returns user-specific options.

Returns user-specific options.

Returns

array
Methods inherited from Nette\ComponentModel\Component
__clone(), __sleep(), __wakeup(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), unmonitor(), validateParent()
Methods inherited from Nette\Object
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Methods inherited from Nette\ComponentModel\IComponent
setParent()
Constants inherited from Nette\ComponentModel\IComponent
NAME_SEPARATOR
Properties summary
public static string $idMask 'frm-%s'
#
public string $caption
#

textual caption or label

textual caption or label

protected mixed $value
#

current control value

current control value

protected Nette\Utils\Html $control
#

control element template

control element template

protected Nette\Utils\Html $label
#

label element template

label element template

protected boolean $disabled FALSE
#
Magic properties summary
public string $htmlId
#
public Nette\Localization\ITranslator|null $translator
#
public mixed $value
#
public boolean $disabled
#
public boolean $omitted
#
public boolean $required
#
public read-only Nette\Forms\Form $form
#
public read-only string $htmlName
#
public read-only array $options
#
public read-only boolean $filled
#
public read-only Nette\Utils\Html $control
#
public read-only Nette\Utils\Html $label
#
public read-only Nette\Utils\Html $controlPrototype
#
public read-only Nette\Utils\Html $labelPrototype
#
public read-only Nette\Forms\Rules $rules
#
public read-only array $errors
#
public write-only $defaultValue
#
Magic properties inherited from Nette\ComponentModel\Component
$name, $parent
Magic properties inherited from Nette\Object
$reflection
Nette 2.1 API documentation generated by ApiGen 2.8.0