RE: [PEAR] Question: QuickForm IT_Static & hierselect

From: Date: Fri, 31 Oct 2008 16:42:49 +0000
Subject: RE: [PEAR] Question: QuickForm IT_Static & hierselect
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-29395@lists.php.net to get a copy of this message
Hi Alexey, Actually I found the bug. I my stupidity I created an empty constructor in the inherited class, which screwed up the parent class initialization. Removing the constructor fixes the problem. Now I get: <select class="element" name="makemodel[0]" onchange=""> Instead of: <select class="element" name="makemodel[0]" onchange="_hs_swapOptions(this.form, 'makemodel', 0);"> I feel I am very close, I know I am missing something really silly, but for the life of I don't know what. Cheers, Michael. -----Original Message----- From: Alexey Borzov [mailto:borz_off@cs.msu.su] Sent: Friday, October 31, 2008 5:38 PM To: Michael Mussulis Cc: pear-general@lists.php.net Subject: Re: [PEAR] Question: QuickForm IT_Static & hierselect Hi Michael, Michael Mussulis wrote: > Sorry to be a pain, but I am quite confused as to how I am supposed to get > this working. I have done as follows: > > $form->registerElementType("myhs", "myhierselect.php", "MyHierselect"); > $hs =& $form->addElement("myhs", 'makemodel', > 'Make/Model:', > array('class' => 'element'), '&nbsp;'); > $hs->setOptions($opts); > $js = $hs->toHtml(); > die($js); > > $js contains both selects, but there's a problem with the group name as > shown below: > > <select name="[0]" onchange="_hs_swapOptions(this.form, '', > 0);"> > > The normal hierselect outputs: > > <select class="element" name="makemodel[0]" > onchange="_hs_swapOptions(this.form, 'makemodel', 0);"> > > Why am I losing the group name? What should I do to correct it? Difficult to say without actually seeing your code, but since there is that [0] part in the name, then you probably did copy-paste the part of group::accept() that deals with appending group name... You may have changed the group name to an empty string somewhere or maybe didn't get it in the first place. Switch on E_NOTICE reporting, it may help.

« previous php.pear.general (#29395) next »