[Quickform] pass by reference problem
| From: | Geoff Hopson | Date: | Mon, 21 Jul 2003 16:23:33 +0000 |
| Subject: | [Quickform] pass by reference problem | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-6685@lists.php.net to get a copy of this message | ||
Hi,
I just upgraded to HTML_Quickform 3.1 from 2.x - a big leap, apparently! Oh, and I changed PHP from 4.1.1 to 4.3.2 at the same time...fatal!
I am creating a form, and passing the form into a function on a class so that the class could populate the form with fields pertinent to that class. Before today this worked. The code kinda looks like this:
class MyInvoice
{
...
function buildForm( &$form) {
$form->addElement(...); etc.
}
}
And, in my page...
$form = &new HTML_Quickform('myname', 'POST');
$myInstance = &new MyInvoice();
$myInstance->buildForm($form);
If I log out the $form value before and after the call to buildForm, the values are the same. If I log the value of the form inside the buildform function, then I see all my elements. It's as if the form is not passed by reference, and the changes I make to it are not reflected in the calling code.
Anyone have any insight? I guess it's more of a PHP problem as opposed to PEAR::Quickform, but everything else seems to be working OK.
Thanks in advance,
Geoff
--
Geoff Hopson
Objectology Ltd.
http://www.objectology.co.uk/