Hi,
Now that I am handle the way of use the dojo combobox I moving to the next stage. What I want to do is updating a second combobox automatically when a value is selected in the first combobox. I have a php that can handle the server side. Any suggestion how it can be done with dojo.
I believe the code below can help other to start a dojo combobox.
Please find my dojo code:
Expand|Select|Wrap|Line Numbers
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Simple ComboBox</title>
- <style type="text/css">
- @import "./dijit/themes/tundra/tundra.css";
- // @import "./dojo/resources/dojo.css"
- </style>
- <script type="text/javascript" src="./dojo/dojo.js"
- djConfig="parseOnLoad: true"></script>
- <script type="text/javascript">
- dojo.require("dojo.parser");
- dojo.require("dijit.form.ComboBox");
- dojo.require("dojo.data.ItemFileReadStore");
- function setCountry(value) {
- console.debug("Selected "+value);
- }
- function setState(value) {
- console.debug("Selected "+value);
- }
- </script>
- </head>
- <body class="tundra">
- <div dojoType="dojo.data.ItemFileReadStore" jsId="countryStore"
- url="http://192.168.2.6:8080/src/autocomplete/autocomplete.php?table_name=countries_list &column_name=name&row_id=CountryID&dependency_column=''&dependency_value=''">
- </div>
- <br> Country: <br>
- <input dojoType="dijit.form.ComboBox"
- store="countryStore"
- value=""
- style="width:150px;font-size:12px;"
- maxListLength="2"
- searchAttr="name"
- name="state2"
- onChange="setCountry" />
- <br> State: <br>
- <div dojoType="dojo.data.ItemFileReadStore" jsId="stateStore"
- url="http://192.168.2.6:8080/src/autocomplete/autocomplete.php?table_name=usa_states &column_name=state_name&row_id=state_id&dependency_column=''&dependency_value=''">
- </div>
- <input dojoType="dijit.form.ComboBox"
- store="stateStore"
- value=""
- searchAttr="name"
- name="state_name"
- onChange="setState" />
- </body>
Thanks
Ronen