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
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • 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

Class BaseControl

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

Nette\ComponentModel\Component implements Nette\ComponentModel\IComponent uses Nette\SmartObject
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|object $caption = null )

Parameters

$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|null
# getForm( boolean $throw = true )

Returns form.

Returns form.

Parameters

$throw

Returns

Nette\Forms\Form|null
Form|null
public
# loadHttpData( )

Loads HTTP data.

Loads HTTP data.

protected 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 Nette\Forms\Controls\BaseControl
# setValue( mixed $value )

Sets control's value.

Sets control's value.

Parameters

$value

Returns

Nette\Forms\Controls\BaseControl
static

Internal

Implementation of

Nette\Forms\IControl::setValue()
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|object $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|null
# getControlPart( )

Returns

Nette\Utils\Html|null
Nette\Utils\Html|null
public Nette\Utils\Html|null
# getLabelPart( )

Returns

Nette\Utils\Html|null
Nette\Utils\Html|null
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( mixed $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 mixed
# getHtmlId( )

Returns control's HTML id.

Returns control's HTML id.

Returns

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

Changes control's HTML attribute.

Changes control's HTML attribute.

Parameters

$name
$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
$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 mixed
# translate( mixed $value, integer $count = null )

Returns translated string.

Returns translated string.

Parameters

$value
$count
count

Returns

mixed
mixed
public Nette\Forms\Controls\BaseControl
# addRule( mixed $validator, string|object $errorMessage = null, mixed $arg = null )

Adds a validation rule.

Adds a validation rule.

Parameters

$validator
$errorMessage
$arg

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

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
$validator
$value

Returns

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

Returns

Nette\Forms\Rules
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|object $message, $translate = true )

Adds error message to the list.

Adds error message to the list.

Parameters

$message
$translate
public string|null
# getError( )

Returns errors corresponding to control.

Returns errors corresponding to control.

Returns

string|null
string|null
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( )
public static
# enableAutoOptionalMode( )

Globally enables new required/optional behavior. This method will be deprecated in next version.

Globally enables new required/optional behavior. This method will be deprecated in next version.

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
public mixed
# __call( $name, $args )

Returns

mixed
mixed

Throws

MemberAccessException
MemberAccessException

Overrides

Nette\ComponentModel\Component::__call()
public static mixed
# extensionMethod( $name, $callback = null )

Deprecated

use Nette\Utils\ObjectMixin::setExtensionMethod()

Returns

mixed
mixed

Overrides

Nette\ComponentModel\Component::extensionMethod()
Methods inherited from Nette\ComponentModel\Component
__clone(), __sleep(), __wakeup(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), setParent(), unmonitor(), validateParent()
Methods used from Nette\SmartObject
__callStatic(), __get(), __isset(), __set(), __unset(), getReflection()
Constants inherited from Nette\ComponentModel\IComponent
NAME_SEPARATOR
Properties summary
public static string $idMask
#'frm-%s'
public string|object $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 mixed $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 boolean $filled
public read-only array $errors
public read-only array $options
public read-only string $error
Magic properties inherited from Nette\ComponentModel\Component
$name, $parent
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0