Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Utils
  • none
  • Tracy
    • Bridges
      • Nette

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
Located at Forms/Controls/BaseControl.php
Methods summary
public
# __construct( string $caption = NULL )

Parameters

$caption
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

Overrides

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

Returns form.

Returns form.

Parameters

$need
exception if form doesn't exist?

Returns

Nette\Forms\Form
Form
public
# loadHttpData( )

Loads HTTP data.

Loads HTTP data.

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

Loads HTTP data.

Loads HTTP data.

Returns

mixed
mixed
public string
# getHtmlName( )

Returns HTML name of control.

Returns HTML name of control.

Returns

string
string
public mixed
# getValue( )

Returns control's value.

Returns control's value.

Returns

mixed
mixed

Implementation of

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

Is control filled?

Is control filled?

Returns

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

Sets control's default value.

Sets control's default value.

Returns

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

Disables or enables control.

Disables or enables control.

Parameters

$value

Returns

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

Is control disabled?

Is control disabled?

Returns

boolean
bool
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

Returns

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

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

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

Returns

boolean
bool

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
Html|string
public Nette\Utils\Html|string
# getLabel( string $caption = NULL )

Generates label's HTML element.

Generates label's HTML element.

Parameters

$caption

Returns

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

Returns control's HTML element template.

Returns control's HTML element template.

Returns

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

Returns label's HTML element template.

Returns label's HTML element template.

Returns

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

Changes control's HTML id.

Changes control's HTML id.

Parameters

$id
ID, or FALSE or NULL

Returns

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

Returns control's HTML id.

Returns control's HTML id.

Returns

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

Changes control's HTML attribute.

Changes control's HTML attribute.

Parameters

$name
name
$value
value

Returns

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

Alias for setHtmlAttribute()

Alias for setHtmlAttribute()

Parameters

$name
name
$value
value

Returns

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

Sets translate adapter.

Sets translate adapter.

Returns

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

Returns translate adapter.

Returns translate adapter.

Returns

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

Returns translated string.

Returns translated string.

Parameters

$value
$count
count

Returns

string
string

Implementation of

Nette\Forms\IControl::translate()
public Nette\Forms\Controls\BaseControl
# addRule( mixed $validator, string $message = NULL, mixed $arg = NULL )

Adds a validation rule.

Adds a validation rule.

Parameters

$validator
type
$message
to display for invalid data
$arg
rule arguments

Returns

Nette\Forms\Controls\BaseControl
static
public Nette\Forms\Rules
# addCondition( mixed $validator, mixed $value = NULL )

Adds a validation condition a returns new branch.

Adds a validation condition a returns new branch.

Parameters

$validator
type
$value
condition arguments

Returns

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

Returns

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

Returns

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

Makes control mandatory.

Makes control mandatory.

Parameters

$value
or error message

Returns

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

Is control mandatory?

Is control mandatory?

Returns

boolean
bool
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
message
public string
# getError( )

Returns errors corresponding to control.

Returns errors corresponding to control.

Returns

string
string
public array
# getErrors( )

Returns errors corresponding to control.

Returns errors corresponding to control.

Returns

array
array

Implementation of

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

Returns

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

Deprecated

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

Sets user-specific option.

Sets user-specific option.

Returns

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

Returns user-specific option.

Returns user-specific option.

Returns

mixed
mixed
public array
# getOptions( )

Returns user-specific options.

Returns user-specific options.

Returns

array
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()
Methods inherited from Nette\Forms\IControl
setValue()
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 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 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 array $errors
Magic properties inherited from Nette\ComponentModel\Component
$name, $parent
Magic properties inherited from Nette\Object
$reflection
Nette 2.3-20161221 API API documentation generated by ApiGen 2.8.0