Simple, really - dropdown lists that change their options depending on other
dropdown lists, but all done through Zend Dojo and using a nice clean MVC
interface. The classic example is Country / State - when you select the
Country from a dropdown, it refreshes the options available in the State
list to match the Country. This sort of functionality is pretty fundamental
stuff, and is really quite simple when you're just knocking it together in
regular ol' PHP/JS.

So far, I have a framework in place that builds these things really quite
cleanly, you can add a new pair of fields (or really as many as you want in
cascade, it should work fine) with 2 dojo divs and a tiny chunk of
Javascript, it just doesn't work when you're editing the row - the populate
method is passing the id value on to the view just fine, but I either need
to find a way to somehow trigger the options list to refresh on page load
(no idea if that will work, and I can't find any Dojo docs describing how to
do it), or, come up with a syntax that lets you pre-populate the dropdowns
while you're still assembling them in the Model. So far it seems that if you
addMultiOptions while there's a Store defined, the MultiOptions are ignored.
So I'm a bit stuck at the moment :/

I'd like to put a good tutorial together for this once it's done too,
because i'm sure a lot of other developers will need this in future, so it
will make fantastic SEO for my development company's blog :P

On Mon, Nov 10, 2008 at 5:18 PM, Bart McLeod <[EMAIL PROTECTED]> wrote:

>  Your problem looks interesting, and I would like to help you, but I am not
> sure if I fully understand what you are trying to achieve.
>
> Could you provide a full and exact functional description of what you are
> trying to accomplish?
>
> Bart
>
> Cameron schreef:
>
> 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]><[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.
>>
>>
>
> --
>   Bart McLeod
> *Space Web Internet Team*
> Middenlaan 47
> 6865 VN Heveadorp
> The Netherlands
> *t* +31(0)26 3392952
> *m* 06 51 51 89 71
> [EMAIL PROTECTED] [EMAIL PROTECTED]
> www.spaceweb.nl  [image: zce logo] [image: zce PHP 5 logo]
>
> *Bart McLeod is a Zend Certified Engineer.*
>
> Click to verify! <http://www.zend.com/zce.php?c=ZEND004591&r=218204904>
>

Reply via email to