Extra Click Event
I have the following code and the problem I am having is after I select an item from the combo box which causes an OnChange event like it should but then if I click anywhere on the screen I get a second OnChange event from the combo box, how do I prevent this extra OnChange event
Thank You
Peter
<!-- The Code -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>QueryReadStore Demo</title>
<style type="text/css">
@import "dojo-release-1.1.1/dijit/themes/tundra/tundra.css";
@import "dojo-release-1.1.1/dojo/resources/dojo.css"
</style>
<script type="text/javascript" src="dojo-release-1.1.1/dojo/dojo.js" djConfig="isDebug: true, parseOnLoad: true"></script>
<script type="text/javascript">
dojo.require("dijit.form.ComboBox");
dojo.require("dijit.form.FilteringSelect");
dojo.require("dojox.data.QueryReadStore");
dojo.provide("ComboBoxReadStore");
dojo.declare(
"ComboBoxReadStore",
dojox.data.QueryReadStore,
{
fetch:function(request) {
request.serverQuery = {q:request.query.name};
return this.inherited("fetch", arguments);
}
}
);
function update_cbox_store() {
// get the combobox widget with id my_combo_box
cbox = dijit.byId('fs');
// create new data store - update URL as needed
new_store = new ComboBoxReadStore({url: 'States2.txt'});
// assign new data store to combobox, should refresh with new
// server data
cbox.store = new_store;
alert("cbox " + cbox);
}
dojo.addOnLoad( function () {
dojo.connect(dojo.byId('foo'), 'onclick', update_cbox_store);
}) ;
function setVal2(val)
{
alert("val= " + val);
}
</script>
</head>
<body class="tundra">
<div dojoType="ComboBoxReadStore" jsId="store"
url="dojo-release-1.1.1/dojox/data/tests/stores/QueryReadStore.php"
requestMethod="get"
>
</div>
State: <input id="fs" dojoType="dijit.form.FilteringSelect" store="store" pageSize="15" OnChange="setVal2" style="width: 300px; font-size: 10pt;"/>
<button id="foo" >Click Me!</button>
</body>
</html>