Phew. Big title.

I'm currently building a large scale application in Zend + Dojo, and with it
being so new, I'm assuming I'm one of the first to attempt such undertaking.
I have built it using Matthew Weier O'Phinney's Pastebox
app<http://weierophinney.net/matthew/archives/189-Pastebin-app-and-conference-updates.html>as
an example of the underlying MVC, and extended it to support accordian
navigation, a heavily tabbed interface, JS onLoad for lazy-loaded content
(it's all about WHERE you load it), XHR posts, extensive use of dojox grids
(with AJAX search), it is a pretty full scale application so far, and it's
all built in a very clean MVC fashion which I'm quite proud of. Now though,
I'm up to one of the final stumbling blocks, and that is trying to AJAX up
drop down selects built using Zend_Dojo_Form where there are dependencies,
i.e., a select needs to be filled appropriately depending on the value of a
parent select - a classic example being a Country select that changes the
State select options.

It is very simple indeed to add AJAX options to a single select, simply by
giving the ComboBox / FilteringSelect a dojox data store and a searchAttr
(although I can't see how to have an id => value pair, the form only submits
values so far...), however, I can't find any examples on the Internet of
people building dependent select boxes in Zend + Dojo.

There's also a possible issue with the $form->populate method, meaning when
we call the edit action in our controller, if too much of the logic that
controls the multiple select boxes is client side, the populate method is
going to act pretty weirdly.

Has anyone managed to build something like this yet? I know the Zend + Dojo
combination is very new, and therefore not many examples of code are out
there yet, but this sort of functionality is pretty fundamental for modern
applications. What I'd like to do is solve this problem in a really clean,
standard Zend MVC way once and for all, and post the results on the
Interwebs for everyone to use.

As a starting point, I guess I should outline a list of ideal qualities in
such a solution:


   - Uses basic Zend MVC layout, i.e. actions in a controller, separate form
   in the model
   - Form is built primarily in Zend_Dojo_Form and can use Dijit controls
   - The options in the select submit the id of the record, not the display
   value.
   - in the "edit" action of your controller, the $form->populate method
   functions correctly.
   - Ideally the data sources for the selects is a dojox.data.QueryReadStore
   that reads from a URL in the MVC structure that returns JSON (i.e. 'url' =>
   '/clients/list-data/format/ajax'), this actually works by default in
   
Pastebox<http://weierophinney.net/matthew/archives/189-Pastebin-app-and-conference-updates.html>
   - The Javascript for controlling the form's onChange is able to be
   included in a single <script type="dojo/connect" event="onLoad">


That last part is important, as the advanced interfaces it's possible to
build with Dijit layout tools are capable of XHR loading page content as
they're going, meaning we have to be able to load the JS up front and not
embed it on the form we're pulling in.

If anyone is working on similar functionality or wants to contact me
off-list to help build a demonstration version to, my email address is
themselves at gmail dot com. Sorry for such a long post!

Reply via email to