You are going to have to do this with Javascript. I'm trying to build the ultimate example of how you do dependent dropdowns using Zend + Dojo, and I've got it so far to the point where it works when adding a new record, but when you try to edit data, the $form->populate method fails to build a dropdown appropriately when using a Dojo datastore (which is the recommended way of doing dependent dropdown menus). So far I've been unable to work it out, and a few posts to this mailing list haven't turned anything up yet, but if/when I eventually work it out, I'll be building a detailed demonstration of how to do it.
On Sat, Nov 8, 2008 at 12:56 AM, Mantz <[EMAIL PROTECTED]> wrote: > > Hey everyone > > I am working with ZF 1.6.2 and I'm trying to select something from one > select element and then enable a second select element. > > I tried it as follows, but there are two problems. First of all go() does > not know $fach2 and if I try to simply echo a random number it shows this > one already when loading the page and does not change it when changing the > select value. Can anyone help me with this? I would rather not try it with > JavaScript, but if there is no other solution, please post this one, too. > Thanx! > > function go() > { > $fach2->disable = true; //does not know $fach2 > > //echo random number > //srand(); > //echo rand(); > } > > public function __construct($options = null) > { > parent::__construct($options); > $this->setAttrib('enctype', 'multipart/form-data'); > > $this->setName('upload_form'); > > $fach = new Zend_Form_Element_Select('fach'); > $fach->setLabel("Fach:") > ->setName('fach') > ->setAttrib('id', 'fach') > ->setAttrib('onChange', $this->go()); > > $fach2 = new Zend_Form_Element_Select('fach2'); > $fach2->disable = true; > $fach2->setLabel("Fach2:") > ->setName('fach2') > ->setAttrib('id', 'fach2'); > > $this->addElements(array($fach, $fach2)); > } > > Would be great if someone could help me. Thanx > > Mantz > > -- > View this message in context: > http://www.nabble.com/Trouble-with-on-Change-in-Zend_Form_Element_Select-tp20383280p20383280.html > Sent from the Zend Framework mailing list archive at Nabble.com. > >