HTML_QuickForm::addGroup()

HTML_QuickForm::addGroup() – Adds an element group

Synopsis

require_once 'HTML/QuickForm.php';

object &HTML_QuickForm::addGroup ( array $elements , string $name = null , mixed $groupLabel = '' , string $separator = null , string $appendName = true )

Description

Adds an element group.

Parameter

array $elements

array of elements composing the group

string $name

(optional) group name

mixed $groupLabel

(optional) group label

mixed $separator

(optional) string or array of strings to separate elements

boolean $appendName

(optional) specify whether the group name should be used in the form element name: groupName[elementName] vs elementName

Return value

return reference to added group of elements

Throws

Possible PEAR_Error values
Error code Error message Reason Solution
QUICKFORM_INVALID_ELEMENT_NAME Element '$elementName' already exists in HTML_QuickForm::addElement() Tried to add a group having a name of an existing element Choose a different name for a group

Note

since 2.8

This function can not be called statically.

Example

Using addGroup()

<?php

$group
[] =& HTML_QuickForm::createElement('text''first''First');
$group[] =& HTML_QuickForm::createElement('text''last''Last');

$form->addGroup($group'name''Name:'',&nbsp;');

?>
Using groups (Previous) HTML class for a form element group (Next)
Last updated: Mon, 28 Jul 2014 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.