Packages

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

Classes

  • NFormControl

Exceptions

  • ArgumentOutOfRangeException
  • DeprecatedException
  • DirectoryNotFoundException
  • FatalErrorException
  • FileNotFoundException
  • InvalidStateException
  • IOException
  • MemberAccessException
  • NotImplementedException
  • NotSupportedException

Functions

  • callback
  • dump
  • Overview
  • Package
  • Class
  • Tree
  • Other releases

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, NFileUpload, NHiddenField, NRadioList, NSelectBox, NTextBase

Indirect known subclasses

NImageButton, NMultiSelectBox, NSubmitButton, NTextArea, NTextInput
Abstract
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 NForm
# getForm( boolean $need = TRUE )

Returns form.

Returns form.

Parameters

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

Returns

NForm
public string
# getHtmlName( )

Returns name of control within a Form & INamingContainer scope.

Returns name of control within a Form & INamingContainer scope.

Returns

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

Returns control's HTML id.

Returns control's HTML id.

Returns

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

NFormControl
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 NFormControl
# setTranslator( ITranslator $translator = NULL )

Sets translate adapter.

Sets translate adapter.

Parameters

$translator
ITranslator

Returns

NFormControl
provides a fluent interface
final 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
# setValue( mixed $value )

Sets control's value.

Sets control's value.

Parameters

$value
mixed

Returns

NFormControl
provides a fluent interface

Implementation of

IFormControl::setValue
public mixed
# getValue( )

Returns control's value.

Returns control's value.

Returns

mixed

Implementation of

IFormControl::getValue
public NFormControl
# setDefaultValue( mixed $value )

Sets control's default value.

Sets control's default value.

Parameters

$value
mixed

Returns

NFormControl
provides a fluent interface
public
# loadHttpData( )

Loads HTTP data.

Loads HTTP data.

Implementation of

IFormControl::loadHttpData
public NFormControl
# setDisabled( boolean $value = TRUE )

Disables or enables control.

Disables or enables control.

Parameters

$value
boolean

Returns

NFormControl
provides a fluent interface
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
final public NHtml
# getControlPrototype( )

Returns control's HTML element template.

Returns control's HTML element template.

Returns

NHtml
final public NHtml
# getLabelPrototype( )

Returns label's HTML element template.

Returns label's HTML element template.

Returns

NHtml
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
provides a fluent interface
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
final public NRules
# getRules( )

Returns

NRules

Implementation of

IFormControl::getRules
public
# notifyRule( NRule $rule )

New rule or condition notification callback.

New rule or condition notification callback.

Parameters

$rule
NRule
public static boolean
# validateEqual( 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
IFormControl
$arg
mixed

Returns

boolean
public static boolean
# validateFilled( IFormControl $control )

Filled validator: is control filled?

Filled validator: is control filled?

Parameters

$control
IFormControl

Returns

boolean
public static boolean
# validateValid( IFormControl $control )

Valid validator: is control valid?

Valid validator: is control valid?

Parameters

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

IFormControl::getErrors
public boolean
# hasErrors( )

Returns

boolean
public
# cleanErrors( )
Methods inherited from NComponent
__clone(), __wakeup(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), setParent(), unmonitor(), validateParent()
Methods inherited from NObject
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod(), getReflection()
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

Nette Framework 0.9.7 (for PHP 5.2) API documentation generated by ApiGen 2.3.0