Detailed Description

The fieldset class holds HTML-fieldset specific attributes and methods.

Class for the HTML fieldset element. Can be used to group other elments together.

Usage

<?php
$form = new depage\htmlform\htmlform('myform');
// add a fieldset container
$myfieldset = $form->addFieldset('myfieldset', array(
'label' => 'Name',
));
// add a text field
$myfieldset->addText('firstName', array(
'label' => 'First name',
));
// add another text field
$myfieldset->addText('lastName', array(
'label' => 'Last name',
));
// process form
$form->process();
// Display the form.
echo ($form);

Definition at line 50 of file fieldset.php.

Inheritance diagram for fieldset:

Public Member Functions

 addElement ($type, $name, $parameters)
 Generates sub-elements. More...
 
 __toString ()
 Renders the fieldset to HTML code. More...
 
- Public Member Functions inherited from container
 __construct ($name, $parameters, $form)
 container class constructor More...
 
 __call ($function, $arguments)
 HTML escaping and add subelements. More...
 
 addChildElements ()
 Sub-element generator hook. More...
 
 addHtml ($html)
 Adds a new custom HTML element to the container. More...
 
 addStepNav ($parameter=array())
 Adds automatic step navigation to output. More...
 
 validate ()
 Validates container and its contents. More...
 
 setRequired ($required=true)
 Sets required-attribute. More...
 
 getElements ($includeFieldsets=false)
 Returns containers subelements. More...
 
 getElement ($name)
 Gets subelement by name. More...
 
 clearValue ()
 Deletes values of all child elements. More...
 
- Public Member Functions inherited from element
 __construct ($name, $parameters, $form)
 element class constructor More...
 
 __call ($function, $arguments)
 HTML escaping. More...
 
 clearValue ()
 resets the value to null More...
 
 getName ()
 Returns the element name. More...
 

Protected Member Functions

 setDefaults ()
 collects initial values across subclasses. More...
 
 htmlClasses ()
 Returns string of the elements' HTML-classes, separated by spaces. More...
 
- Protected Member Functions inherited from container
 addElement ($type, $name, $parameters)
 Generates sub-elements. More...
 
- Protected Member Functions inherited from element
 setDefaults ()
 Collects initial values across subclasses. More...
 
 checkParameters ($parameters)
 checks element parameters More...
 
 log ($argument, $type=null)
 error & warning logger More...
 
 htmlEscape ($options=array())
 Escapes HTML in strings and arrays of strings. More...
 

Protected Attributes

 $form
 parent HTML form. More...
 
- Protected Attributes inherited from container
 $elements = array()
 References to input elements and fieldsets. More...
 
 $elementsAndHtml = array()
 Input element, fieldset and custom HTML object references. More...
 
 $form
 Parent form object reference. More...
 
- Protected Attributes inherited from element
 $name
 Element name. More...
 
 $validated = false
 True if the element has been validated before. More...
 
 $log
 Log object reference. More...
 

Additional Inherited Members

- Data Fields inherited from element
 $valid
 Contains element validation status/result. More...
 

Member Function Documentation

__toString ( )

Renders the fieldset to HTML code.

If the fieldset contains subelements it calls their rendering methods.

Returns
string HTML-rendered fieldset

Definition at line 131 of file fieldset.php.

addElement (   $type,
  $name,
  $parameters 
)

Generates sub-elements.

Calls parent class to generate an input element or a fieldset and add it to its list of elements

Parameters
string$typeelememt type
string$nameelement name
array$parameterselement attributes: HTML attributes, validation parameters etc.
Returns
object $newElement new element object
See Also
__call()
addChildElements()

Definition at line 89 of file fieldset.php.

htmlClasses ( )
protected

Returns string of the elements' HTML-classes, separated by spaces.

Returns
string $classes HTML-classes

Definition at line 107 of file fieldset.php.

setDefaults ( )
protected

collects initial values across subclasses.

The constructor loops through these and creates settable class attributes at runtime. It's a compact mechanism for initialising a lot of variables.

Returns
void

Definition at line 66 of file fieldset.php.

Field Documentation

$form
protected

parent HTML form.

Definition at line 55 of file fieldset.php.


The documentation for this class was generated from the following file: