Namespaces

  • Nette
    • Application
    • Caching
    • Collections
    • Config
    • Forms
    • IO
    • Loaders
    • Mail
    • Reflection
    • Security
    • Templates
    • Web
  • None
  • PHP

Classes

  • Button
  • Checkbox
  • ConventionalRenderer
  • FileUpload
  • Form
  • FormContainer
  • FormControl
  • FormGroup
  • HiddenField
  • ImageButton
  • InstantClientScript
  • MultiSelectBox
  • RadioList
  • Rule
  • Rules
  • SelectBox
  • SubmitButton
  • TextArea
  • TextBase
  • TextInput

Interfaces

  • IFormControl
  • IFormRenderer
  • INamingContainer
  • ISubmitterControl
  • Overview
  • Namespace
  • Class
  • Tree
  • Other releases

Class FormControl

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

Nette\Object
Extended by Nette\Component implements Nette\IComponent
Extended by Nette\Forms\FormControl implements Nette\Forms\IFormControl

Direct known subclasses

Nette\Forms\Button, Nette\Forms\Checkbox, Nette\Forms\FileUpload, Nette\Forms\HiddenField, Nette\Forms\RadioList, Nette\Forms\SelectBox, Nette\Forms\TextBase

Indirect known subclasses

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

Parameters

$caption
string
caption
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
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 string
# getHtmlName( )

Returns name of control within a Form & INamingContainer scope.

Returns name of control within a Form & INamingContainer scope.

Returns

string
public Nette\Forms\FormControl
# 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\FormControl
provides a fluent interface
public string
# getHtmlId( )

Returns control's HTML id.

Returns control's HTML id.

Returns

string
public Nette\Forms\FormControl
# setOption( string $key, mixed $value )

Sets user-specific option. Common options:

  • 'rendered' - indicate if method getControl() have been called
  • 'required' - indicate if ':required' rule has been applied
  • 'description' - textual or Html object description (recognized by ConventionalRenderer)

Sets user-specific option. Common options:

  • 'rendered' - indicate if method getControl() have been called
  • 'required' - indicate if ':required' rule has been applied
  • 'description' - textual or Html object description (recognized by ConventionalRenderer)

Parameters

$key
string
key
$value
mixed
value

Returns

Nette\Forms\FormControl
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

Returns

mixed
final public array
# getOptions( )

Returns user-specific options.

Returns user-specific options.

Returns

array
public Nette\Forms\FormControl
# setTranslator( Nette\ITranslator $translator = NULL )

Sets translate adapter.

Sets translate adapter.

Parameters

$translator
Nette\ITranslator

Returns

Nette\Forms\FormControl
provides a fluent interface
final public Nette\ITranslator|null
# getTranslator( )

Returns translate adapter.

Returns translate adapter.

Returns

Nette\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

Nette\Forms\IFormControl::translate
public Nette\Forms\FormControl
# setValue( mixed $value )

Sets control's value.

Sets control's value.

Parameters

$value
mixed

Returns

Nette\Forms\FormControl
provides a fluent interface

Implementation of

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

Returns control's value.

Returns control's value.

Returns

mixed

Implementation of

Nette\Forms\IFormControl::getValue
public Nette\Forms\FormControl
# setDefaultValue( mixed $value )

Sets control's default value.

Sets control's default value.

Parameters

$value
mixed

Returns

Nette\Forms\FormControl
provides a fluent interface
public
# loadHttpData( )

Loads HTTP data.

Loads HTTP data.

Implementation of

Nette\Forms\IFormControl::loadHttpData
public Nette\Forms\FormControl
# setDisabled( boolean $value = TRUE )

Disables or enables control.

Disables or enables control.

Parameters

$value
boolean

Returns

Nette\Forms\FormControl
provides a fluent interface
public boolean
# isDisabled( )

Is control disabled?

Is control disabled?

Returns

boolean

Implementation of

Nette\Forms\IFormControl::isDisabled
public Nette\Web\Html
# getControl( )

Generates control's HTML element.

Generates control's HTML element.

Returns

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

Generates label's HTML element.

Generates label's HTML element.

Parameters

$caption
string

Returns

Nette\Web\Html
final public Nette\Web\Html
# getControlPrototype( )

Returns control's HTML element template.

Returns control's HTML element template.

Returns

Nette\Web\Html
final public Nette\Web\Html
# getLabelPrototype( )

Returns label's HTML element template.

Returns label's HTML element template.

Returns

Nette\Web\Html
public Nette\Forms\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 arguments

Returns

Nette\Forms\FormControl
provides a fluent interface
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\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
Nette\Forms\IFormControl
form control
$operation
mixed
condition type
$value
mixed
optional condition arguments

Returns

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

Returns

Nette\Forms\Rules

Implementation of

Nette\Forms\IFormControl::getRules
public
# notifyRule( Nette\Forms\Rule $rule )

New rule or condition notification callback.

New rule or condition notification callback.

Parameters

$rule
Nette\Forms\Rule
public static boolean
# validateEqual( Nette\Forms\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
Nette\Forms\IFormControl
$arg
mixed

Returns

boolean
public static boolean
# validateFilled( Nette\Forms\IFormControl $control )

Filled validator: is control filled?

Filled validator: is control filled?

Parameters

$control
Nette\Forms\IFormControl

Returns

boolean
public static boolean
# validateValid( Nette\Forms\IFormControl $control )

Valid validator: is control valid?

Valid validator: is control valid?

Parameters

$control
Nette\Forms\IFormControl

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

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

Returns

boolean
public
# cleanErrors( )
Methods inherited from Nette\Component
__clone(), __wakeup(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), setParent(), unmonitor(), validateParent()
Methods inherited from Nette\Object
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
Constants inherited from Nette\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 Nette\Web\Html $control
#

control element template

control element template

protected Nette\Web\Html $label
#

label element template

label element template

Nette Framework 0.9.7 API documentation generated by ApiGen 2.3.0