Re: FormBuilder, advmultiselect and crossLinks

From: Date: Tue, 06 Dec 2005 20:48:57 +0000
Subject: Re: FormBuilder, advmultiselect and crossLinks
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22170@lists.php.net to get a copy of this message
FormBuilder doesn't support advmultiselect as it is now. -- Justin Patrin Ok that's what I saw in the source and I understand, as advmultiselect is not included by default in the HTML_QuickForm Package. It's not worth one more dependency when you can deal with what you have in your hands :
I finally used postGenerateForm, got the $options and $selected from the original select to create an advmultiselect. few lines of code and seemingly few cpu/mem usage : function postGenerateForm(& $form, & $fb){ HTML_QuickForm::registerElementType('advmultiselect','HTML/QuickForm/advmultiselect.php','HTML_QuickForm_advmultiselect'); $current=& $form->getElement('__crossLink_filmacteur_idfilm_idacteur'); $_cros=& HTML_QuickForm::createElement('advmultiselect','__crossLink_filmacteur_idfilm_idacteur','acteurs'); $_cros->_options=$current->_options; $_cros->setSelected($current->getSelected()); $form->removeElement('__crossLink_filmacteur_idfilm_idacteur'); $form->insertElementBefore(&$_cros,'__submit__');
    	}


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