[Dojo-interest] Newbie: How to update a select list with data from a (django) backend

wandering.womble at gmail.com wandering.womble at gmail.com
Wed Feb 7 14:03:31 MST 2007

Hi there-

please be gentle, I'm not a web-developer, but am now responsible for
an intranet application, that, well, needs some TLC.

I need to make some pages with drop-down selects, with the latter drop
downs option lists depending on the previous selects current value.

Let me try to illustrate:

Widget: SelectA

Size: SelectB

Colour: SelectC

Select A starts life populated with, eg 'foos', 'bars'.  If 'foos' is
selected, SelectB should display "tiny", "small".  If 'bars' is
selected " SelectB should display "large", and "enormous".  SelectC is
likewise dependant on the the value selected for SelectB.

The easiest way that I can see to make this work is if the underlying
machinery works something like:

server: send page to browser with SelectA populated, SelectB and SelectC empty.
browser/dojo: on click for SelectA, send httpXMLObject request to server
server: send back appropriate values for SelectB
dojo: update SelectB with new list contents.

Same process for SelectC (and any further objects down the page.)
Note: above is from reading the glossy web 2.0 overviews, no real experience :-/

(Currently we have some uber pages where most of the information is
built into the custom javascript; and it's not exactly data-driven

Does this sound reasonable?

I'm also thinking that if performance proves to be an issue, I could
then 'upgrade' the above to pre-load all the options on page load,
store the data in some kind of javascript array/datastore, and
hopefully it'd only require minor tweaking to the usage of Dojo.
(Back to what we have now, but in a data-driven way.)
Does that also sound reasonable?  Any suggestions for how to create
the page(s) now to make such a change easier in the future?

Would some kind soul please give me some pointers (possibly an
example?) for how to hook this up with Dojo's iobind/JSON transport (I
think django can/will do JSON...)  Or a link to a very simple example?

Any help appreciated-



More information about the Dojo-interest mailing list