Re: Question: QuickForm IT_Static & hierselect

From: Date: Fri, 31 Oct 2008 15:37:34 +0000
Subject: Re: Question: QuickForm IT_Static & hierselect
References: 1 2 3 4 5 6 7 8 9  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-29394@lists.php.net to get a copy of this message
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'), ' ');
    $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 (#29394) next »