Expand the plotCity > Web Pages node.
Open index.jsp in the editor pane.
Add a publish attribute to the thisCity combobox widget and set it to /cities:
<a:widget id="thisCity"
name="dojo.combobox"
publish="/cities"
subscribe="/cb"
value="${StateBean.cities}" />
Expand the plotCity > Web Pages node.
Open glue.js in a source editor.
Add the following handler to the end of glue.js:
jmaki.subscribe("/cities/onSelect", function(item) {
var city = item.value;
var state = jmaki.attributes.get('thisState').getValue();
var location = city + ", " + state;
var encodedLocation = encodeURIComponent("location=" + location);
var url = jmaki.xhp +
"?id=yahoogeocoder&urlparams=" +
encodedLocation;
jmaki.doAjax({url: url, callback : function(req) {
if (req.responseText.length > 0) {
// convert the response to an object
var response = eval("(" + req.responseText + ")");
var coordinates = response.coordinates;
v = {results:coordinates};
jmaki.publish("/jmaki/plotmap", coordinates);
} else {
jmaki.log("Failed to get coordinates for " +
location );
}
}
});
});
Save glue.js.