HTML_QuickForm::insertElementBefore()

HTML_QuickForm::insertElementBefore() -- Inserts a new element right before the other element

Synopsis

require_once 'HTML/QuickForm.php';

object &HTML_QuickForm::insertElementBefore (object &$element, string $nameAfter)

Описание

Inserts a new element right before the other element.

It is not possible to check whether the $element is already added to the form, therefore if you want to move the existing form element to a new position, you'll have to use removeElement():
$form->insertElementBefore($form->removeElement('foo', false), 'bar');

Параметр

object &$element

Element to insert (instance of HTML_QuickForm_element)

string $nameAfter

Name of the element before which the new one is inserted

Возвращаемое значение

return reference to inserted element.

Throws

Таблица 42-1. Возможные значения PEAR_Error

Error codeError messageReasonSolution
QUICKFORM_INVALID_ELEMENT_NAMESeveral elements named $nameAfter exist in HTML_QuickForm::insertElementBefore()Several elements named $nameAfter (e.g.: radios) exist in the form. The method does not handle this case.Insert before some other element. Consider adding a dummy element with a unique name.
QUICKFORM_INVALID_ELEMENT_NAMEElement '$elementName' already exists in HTML_QuickForm::insertElementBefore()Element exists with the same name as $element but of different typeGive some other name to the inserted element.
QUICKFORM_NONEXIST_ELEMENTElement $nameAfter does not exist in HTML_QuickForm::insertElementBefore()Tried to insert before a non-existant elementCheck the element's name spelling

Заметка

since 3.2.4

Эта функция не должна вызываться статически.


HIVE: All information for read only. Please respect copyright!
Hosted by hive йца: йХЕБЯЙЮЪ ЦНПНДЯЙЮЪ АХАКХНРЕЙЮ