Packages

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

Classes

  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage

Class NFormControl

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

NObject
Extended by NComponent implements IComponent
Extended by NFormControl implements IFormControl

Direct known subclasses

NButton, NCheckbox, NHiddenField, NRadioList, NSelectBox, NTextBase, NUploadControl

Indirect known subclasses

NImageButton, NMultiSelectBox, NSubmitButton, NTextArea, NTextInput
Abstract
Package: Nette\Forms\Controls
Author: David Grudl
Located at Forms/Controls/BaseControl.php
Methods summary
public
# __construct( string $caption = NULL )

Parameters

$caption
string
caption

Overrides

NComponent::__construct()
protected
# 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

Overrides

NComponent::attached()
public NForm
# getForm( boolean $need = TRUE )

Returns form.

Returns form.

Parameters

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

Returns

NForm
public
# loadHttpData( )

Loads HTTP data.

Loads HTTP data.

Implementation of

IFormControl::loadHttpData()
public string
# getHtmlName( )

Returns HTML name of control.

Returns HTML name of control.

Returns

string
public NFormControl
# setValue( mixed $value )

Sets control's value.

Sets control's value.

Parameters

$value
mixed

Returns

NFormControl

Implementation of

IFormControl::setValue()
public mixed
# getValue( )

Returns control's value.

Returns control's value.

Returns

mixed

Implementation of

IFormControl::getValue()
public boolean
# isFilled( )

Is control filled?

Is control filled?

Returns

boolean
public NFormControl
# setDefaultValue( $value )

Sets control's default value.

Sets control's default value.

Returns

NFormControl
public NFormControl
# setDisabled( boolean $value = TRUE )

Disables or enables control.

Disables or enables control.

Parameters

$value
boolean

Returns

NFormControl
public boolean
# isDisabled( )

Is control disabled?

Is control disabled?

Returns

boolean

Implementation of

IFormControl::isDisabled()
public NHtml
# getControl( )

Generates control's HTML element.

Generates control's HTML element.

Returns

NHtml
public NHtml
# getLabel( string $caption = NULL )

Generates label's HTML element.

Generates label's HTML element.

Parameters

$caption
string

Returns

NHtml
public NHtml
# getControlPrototype( )

Returns control's HTML element template.

Returns control's HTML element template.

Returns

NHtml
public NHtml
# getLabelPrototype( )

Returns label's HTML element template.

Returns label's HTML element template.

Returns

NHtml
public NFormControl
# setHtmlId( string $id )

Changes control's HTML id.

Changes control's HTML id.

Parameters

$id
string
new ID, or FALSE or NULL

Returns

NFormControl
public string
# getHtmlId( )

Returns control's HTML id.

Returns control's HTML id.

Returns

string
public NFormControl
# setAttribute( string $name, mixed $value = TRUE )

Changes control's HTML attribute.

Changes control's HTML attribute.

Parameters

$name
string
name
$value
mixed
value

Returns

NFormControl
public NFormControl
# setTranslator( ITranslator $translator = NULL )

Sets translate adapter.

Sets translate adapter.

Returns

NFormControl
public ITranslator|null
# getTranslator( )

Returns translate adapter.

Returns translate adapter.

Returns

ITranslator|null
public string
# translate( string $s, integer $count = NULL )

Returns translated string.

Returns translated string.

Parameters

$s
string
$count
integer
plural count

Returns

string

Implementation of

IFormControl::translate()
public NFormControl
# 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

NFormControl
public NRules
# 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

NRules
new branch
public NRules
# 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 arguments

Returns

NRules
new branch
public NRules
# getRules( )

Returns

NRules

Implementation of

IFormControl::getRules()
public NFormControl
# setRequired( string $message = NULL )

Makes control mandatory.

Makes control mandatory.

Parameters

$message
string
error message

Returns

NFormControl
public boolean
# isRequired( )

Is control mandatory?

Is control mandatory?

Returns

boolean
public
# 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.

Returns errors corresponding to control.

Returns

array

Implementation of

IFormControl::getErrors()
public boolean
# hasErrors( )

Returns

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

Returns

array
public NFormControl
# setOption( $key, $value )

Sets user-specific option. Options recognized by DefaultFormRenderer

  • 'description' - textual or Html object description

Sets user-specific option. Options recognized by DefaultFormRenderer

  • 'description' - textual or Html object description

Returns

NFormControl
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 NComponent
__clone(), __sleep(), __wakeup(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), unmonitor(), validateParent()
Methods inherited from NObject
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Methods inherited from IComponent
setParent()
Constants inherited from IComponent
NAME_SEPARATOR
Properties summary
public static string $idMask 'frm%s-%s'
#
public string $caption
#

textual caption or label

textual caption or label

protected mixed $value
#

unfiltered control value

unfiltered control value

protected NHtml $control
#

control element template

control element template

protected NHtml $label
#

label element template

label element template

Magic properties summary
public string $htmlId
#
public ITranslator|null $translator
#
public mixed $value
#
public boolean $disabled
#
public boolean $required
#
public read-only NForm $form
#
public read-only string $htmlName
#
public read-only array $options
#
public read-only boolean $filled
#
public read-only NHtml $control
#
public read-only NHtml $label
#
public read-only NHtml $controlPrototype
#
public read-only NHtml $labelPrototype
#
public read-only NRules $rules
#
public read-only array $errors
#
public write-only $defaultValue
#
Magic properties inherited from NComponent
$name, $parent
Magic properties inherited from NObject
$reflection
Nette Framework 2.0.18 (for PHP 5.2, prefixed) API documentation generated by ApiGen 2.8.0