HTML_QuickForm::addGroup()

HTML_QuickForm::addGroup() -- Adds an element group

概要

require_once 'HTML/QuickForm.php';

object &HTML_QuickForm::addGroup (array $elements [, string $name = NULL [, mixed $groupLabel = '' [, string $separator = NULL [, string $appendName = TRUE]]]])

説明

Adds an element group.

パラメータ

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 reference to added group of elements

例外・エラー

表 40-1PEAR_Error の値

Error codeError messageReasonSolution
QUICKFORM_INVALID_ELEMENT_NAMEElement '$elementName' already exists in HTML_QuickForm::addElement()Tried to add a group having a name of an existing elementChoose a different name for a group

注意

since 2.8

この関数は、スタティックにコールする ことはできません。

例 40-1Using addGroup()


<?php

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

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

?>