#80 [NEW]: HTML_QuickForm::addElement($element) dosen't pass by reference
| From: | marba126 at student dot liu dot se | Date: | Wed, 08 Oct 2003 20:08:41 +0000 |
| Subject: | #80 [NEW]: HTML_QuickForm::addElement($element) dosen't pass by reference | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-22499@lists.php.net to get a copy of this message | ||
From: marba126 at student dot liu dot se
Operating system: Windows 98 SE
PHP version: Irrelevant
PHP Bug Type: HTML_QuickForm
Bug description: HTML_QuickForm::addElement($element) dosen't pass by reference
Description:
------------
Unexpected beaviour: using $element->setValue(), after $element has been
added to the form with addElement($element), will have no effect. This is
probably because addElement() dosen't pass by reference. Thus addElement()
creates a copy of the element you added (which will not be affected when
you change the origin element).
HTML_QuickForm ver. 3.1.1
Reproduce code:
---------------
<?php
require_once ("HTML/QuickForm.php");
$form = new HTML_QuickForm();
$text =& $form->createElement('text', 'testText', 'This should be
"Set
after addElement() call" :', 'size=40');
$text->setValue("Set before addElement() call");
$form->addElement($text);
$text->setValue("Set after addElement() call");
$form->display();
?>
Expected result:
----------------
The value of the text input field is expected to be "Set after
addElement() call" when form is displayd.
Actual result:
--------------
The value of the text input field is "Set before addElement() call" when
form is displayd.
--
Edit bug report at http://pear.php.net/bugs/bug.php?id=80&edit=1
--