[Dojo-interest] Combination of combo/dropdown boxes

Sells, Fred fred at adventistcare.org
Mon Sep 25 08:40:35 MDT 2006

I just had to do that.  here is my code

function selectPunchLocation(location) { //called from select on first list.
	        url: QUERY,
	        load: function(type, data, evt) { 
	        			var w =
dojo.widget.byId("PunchDepartment"); //is a dojotype=Select
	        mimetype: "text/json",
	        content: {facility:location, action:"jobcodes"}

dgi returns data that looks like...

["Director Of Nursing", "A01"],
["Asst. Dir Nursing", "A02"],
["RN Supervisor", "A03"],
["RN Staff", "A04"],
["Corp QMS", "A92"],
["Resident Care Coordinator", "B02"],
["LPN/LVN Supervisor", "B03"],
["LPN/LVN Staff", "B04"],
["Lead CNA", "C09"],
["CNA", "C10"],
["Nursing Asst/Trainee", "C11"]

Hi everyone!

I'm new to dojo, so please bear with me.

I'm trying to do a drop-down/combo box (preferably dojo combobox) 
combination with two boxes where you first select country in the 1. box 
and then get a list of cities in that country in the other.

I've already made a country.php that returns the countries as a JSON 
object and a city.php?country=someCountryCode that returns a JSON object 
with the cities of the specified country.

So basically I'm trying to get the selection of the first combobox to 
reflect what is going to be the dataUrl in the second combobox just 
below. If I e.g. select "Brazil" from the 1. one, I'd like to have 
dataUrl="city.php?country=Brazil" (or, actually, I want the key value 
from the 1. box, like "Br" for Brazil). How would I go about accessing 
the value/key that is selected in the country combobox? Can it be done 
with the dojo api somehow or should I use some JS like 
document.myForm.countryCombo.value; and if so, how would I put that into 
the dataUrl?

Can anyone point me in the right direction? Seems my googling isn't that 
good, as I'm quite sure someone else has done something like this before 
with dojo.


Eirik Hodne

Dojo FAQ: http://dojo.jot.com/FAQ
Dojo Book: http://manual.dojotoolkit.org/DojoDotBook
Dojo-interest at dojotoolkit.org

More information about the Dojo-interest mailing list