Class FormContainer (namespace Nette\Forms)


Container for form controls.

Object
   |
   --Component
      |
      --ComponentContainer
         |
         --FormContainer

Implements interfaces:

ArrayAccess (internal interface), INamingContainer

Direct Known Sub-classes:

Author: David Grudl
Copyright: Copyright (c) 2004, 2009 David Grudl
Located: in /Forms/FormContainer.php (line 36)
Public Method Summary
Button
addButton (string $name, string $caption)
Adds push buttons with no default behavior.
Checkbox
addCheckbox (string $name, string $caption)
Adds check box control to the form.
void
addComponent ($component, string $name, [string $insertBefore = NULL])
Adds the specified component to the IComponentContainer.
FormContainer
addContainer (string $name)
Adds naming container to the form.
FileUpload
addFile (string $name, string $label)
Adds control that allows the user to upload files.
HiddenField
addHidden (string $name)
Adds hidden form control used to store a non-displayed value.
ImageButton
addImage (string $name, [string $src = NULL], [string $alt = NULL])
Adds graphical button used to submit form.
MultiSelectBox
addMultiSelect (string $name, string $label, [$items = NULL], [int $size = NULL])
Adds select box control that allows multiple item selection.
TextInput
addPassword (string $name, string $label, [int $cols = NULL], [int $maxLength = NULL])
Adds single-line text input control used for sensitive input such as passwords.
RadioList
addRadioList (string $name, string $label, [$items = NULL])
Adds set of radio button controls to the form.
RepeaterControl
addRepeater (string $name)
Adds control that repeats a specified prototype for each item in the list.
SelectBox
addSelect (string $name, string $label, [$items = NULL], [int $size = NULL])
Adds select box control that allows single item selection.
SubmitButton
addSubmit (string $name, string $caption)
Adds button used to submit form.
TextInput
addText (string $name, string $label, [int $cols = NULL], [int $maxLength = NULL])
Adds single-line text input control to the form.
TextArea
addTextArea (string $name, string $label, [int $cols = 40], [int $rows = 10])
Adds multi-line text input control to the form.
ArrayIterator
Iterates over all form controls.
Form
getForm ([bool $need = TRUE])
Returns form.
bool
offsetExists (string $name)
Does component specified by name exists?
IComponent
offsetGet (string $name)
Returns component specified by name. Throws exception if component doesn't exist.
void.
offsetSet (string $name, IComponent $component)
Adds the component to the container.
void
offsetUnset (string $name)
Removes component from the container. Throws exception if component doesn't exist.
void
setCurrentGroup ([FormGroup $group = NULL])
Methods Inherited From ComponentContainer
addComponent(), createComponent(), getComponent(), getComponents(), removeComponent(), validateChildComponent(), __clone()
Methods Inherited From Component
__construct(), attached(), detached(), getName(), getParent(), getService(), getServiceLocator(), lookup(), lookupPath(), monitor(), setParent(), setServiceLocator(), validateParent(), __clone(), __wakeup()
Methods Inherited From Object
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset()
Variable Summary
protected FormGroup $currentGroup

line 39


Method Details

line 247

addButton

public Button addButton (string $name, string $caption)

Adds push buttons with no default behavior.

Input
string $name control name
string $caption caption
Output
Button  

line 177

addCheckbox

public Checkbox addCheckbox (string $name, string $caption)

Adds check box control to the form.

Input
string $name control name
string $caption caption
Output
Checkbox  

line 61

addComponent

public void addComponent ($component, string $name, [string $insertBefore = NULL])

Adds the specified component to the IComponentContainer.

Input
$component
string $name
string $insertBefore
Output
void  
Throws
throws InvalidStateException

line 273

addContainer

public FormContainer addContainer (string $name)

Adds naming container to the form.

Input
string $name name
Output
FormContainer  

line 152

addFile

public FileUpload addFile (string $name, string $label)

Adds control that allows the user to upload files.

Input
string $name control name
string $label label
Output
FileUpload  

line 164

addHidden

public HiddenField addHidden (string $name)

Adds hidden form control used to store a non-displayed value.

Input
string $name control name
Output
HiddenField  

line 261

addImage

public ImageButton addImage (string $name, [string $src = NULL], [string $alt = NULL])

Adds graphical button used to submit form.

Input
string $name control name
string $src URI of the image
string $alt alternate text for the image
Output
ImageButton  

line 221

addMultiSelect

public MultiSelectBox addMultiSelect (string $name, string $label, [$items = NULL], [int $size = NULL])

Adds select box control that allows multiple item selection.

Input
string $name control name
string $label label
$items options from which to choose
int $size number of rows that should be visible
Output
MultiSelectBox  

line 121

addPassword

public TextInput addPassword (string $name, string $label, [int $cols = NULL], [int $maxLength = NULL])

Adds single-line text input control used for sensitive input such as passwords.

Input
string $name control name
string $label label
int $cols width of the control
int $maxLength maximum number of characters the user may enter
Output
TextInput  

line 191

addRadioList

public RadioList addRadioList (string $name, string $label, [$items = NULL])

Adds set of radio button controls to the form.

Input
string $name control name
string $label label
$items options from which to choose
Output
RadioList  

line 287

addRepeater

public RepeaterControl addRepeater (string $name)

Adds control that repeats a specified prototype for each item in the list.

Input
string $name control name
Output
RepeaterControl  

line 206

addSelect

public SelectBox addSelect (string $name, string $label, [$items = NULL], [int $size = NULL])

Adds select box control that allows single item selection.

Input
string $name control name
string $label label
$items items from which to choose
int $size number of rows that should be visible
Output
SelectBox  

line 234

addSubmit

public SubmitButton addSubmit (string $name, string $caption)

Adds button used to submit form.

Input
string $name control name
string $caption caption
Output
SubmitButton  

line 106

addText

public TextInput addText (string $name, string $label, [int $cols = NULL], [int $maxLength = NULL])

Adds single-line text input control to the form.

Input
string $name control name
string $label label
int $cols width of the control
int $maxLength maximum number of characters the user may enter
Output
TextInput  

line 139

addTextArea

public TextArea addTextArea (string $name, string $label, [int $cols = 40], [int $rows = 10])

Adds multi-line text input control to the form.

Input
string $name control name
string $label label
int $cols width of the control
int $rows height of the control in text lines
Output
TextArea  

line 75

getControls

public ArrayIterator getControls ()

Iterates over all form controls.

Output
ArrayIterator  

line 87

getForm

public Form getForm ([bool $need = TRUE])

Returns form.

Overridden in child classes as:

Input
bool $need throw exception if form doesn't exist?
Output
Form  

line 329

offsetExists

public bool offsetExists (string $name)

Does component specified by name exists?

Implementation of:

ArrayAccess::offsetExists
Input
string $name component name
Output
bool  

line 317

offsetGet

public IComponent offsetGet (string $name)

Returns component specified by name. Throws exception if component doesn't exist.

Implementation of:

ArrayAccess::offsetGet
Input
string $name component name
Output
IComponent  
Throws
throws InvalidArgumentException

line 304

offsetSet

public void. offsetSet (string $name, IComponent $component)

Adds the component to the container.

Implementation of:

ArrayAccess::offsetSet
Input
string $name component name
IComponent $component
Output
void.  

line 341

offsetUnset

public void offsetUnset (string $name)

Removes component from the container. Throws exception if component doesn't exist.

Implementation of:

ArrayAccess::offsetUnset
Input
string $name component name
Output
void  

line 46

setCurrentGroup

public void setCurrentGroup ([FormGroup $group = NULL])

Input
FormGroup $group
Output
void