object &HTML_QuickForm::addGroup (
array $elements
, string $name
= null
, mixed $groupLabel = ''
, string $separator
= null
, string $appendName
= true
)
Adds an element group.
$elements
array of elements composing the group
$name
(optional) group name
$groupLabel
(optional) group label
$separator
(optional) string or array of strings to separate elements
$appendName
(optional) specify whether the group name should be used in the form element name: groupName[elementName] vs elementName
return reference to added group of elements
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 |
since 2.8
This function can not be called statically.
Using addGroup()
<?php
$group[] =& HTML_QuickForm::createElement('text', 'first', 'First');
$group[] =& HTML_QuickForm::createElement('text', 'last', 'Last');
$form->addGroup($group, 'name', 'Name:', ', ');
?>