Re: QuickForm hierselect muiltiple choice problem

From: Date: Thu, 03 Jun 2004 02:36:47 +0000
Subject: Re: QuickForm hierselect muiltiple choice problem
References: 1 2 3 4 5 6  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12849@lists.php.net to get a copy of this message
Joshua Eichorn wrote:
Helder Miguel Rodrigues wrote:
Alexey Borzov wrote:
Hi! Helder Miguel Rodrigues wrote:
There is any solution to be possible to have multiple selections in the second select?
I think you set the 'multiple' attribute for both selects this way. Get the hierselect's elements by using getElements() and update the attributes only of the second one.
I dont understand how can i do that?
$foo =& $form->addElement('hierselect', ...); $els =& $foo->getElements(); $els[1]->updateAttributes(array('size' => 6, 'multiple' => 'multiple')); I didn't test this, but it *may* work...
It didnt work! :( Any another suggestion? Another type of implementation? Thanks
You'll want to do: $hsfilerelatorioperm = &$form->addElement('hierselect', 'filerelatorioperm', array('Relatório:')); $hsfilerelatorioperm->setMainOptions($perms); $hsfilerelatorioperm->setSecOptions(array(array(), array(), array(), array(), $clientsInternet, $clientsInstitucional)); $els =& $hsfilerelatorioperm->getElements(); $els[1]->updateAttributes(array('multiple' => 'multiple','size'=>6)); You'll also need to update the swapOptions method since setting it to multiple will change the name of the element and make it fail with a js error. I posted my updated method for this a couple posts ago, you'll need to update it a bit since in my case each element is a multiple.
The line to look at is: ."        ctl = frm.form[grpName+'['+i+'][]'];\n"
-josh It doesnt populate the second select! I dont understand what is happening!
:( I use the code above, I changed the swapOtions function in hierselect.php with the code in the other post and nothing happens! Can you show me your code or give me another kind of help! Thanks a lot in advance! Helder

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