Categories | Question details Back To List | ||
How can I use with dynamic content dhtmlXComboFromSelect (Ajax)? Need to function more or less like this: <!---------------------------------------------------------------------------------------> <select name=state id=state class=inputi style="width:170px;"> <option value="state1">state1</option> <option value="state2">state2</option> <option value="state3">state3</option> </select> <span id=span_cities> <select name=cities id=cities class=inputi style="width:170px;"> <option value="city1">city1</option> <option value="city2">city2</option> <option value="city3">city3</option> </select> </span> <script> var state = dhtmlXComboFromSelect("state"); state.readonly(1); state.enableOptionAutoHeight(1); state.attachEvent("onChange",onChangeFuncNewCities); function onChangeFuncNewCities() { ajaxGet("cities.php","span_cities"); } var cities = dhtmlXComboFromSelect("cities"); cities.readonly(1); cities.enableOptionAutoHeight(1); </script> <!---------------------------------------------------------------------------------------> How do I do that? is it possible? ty Answer posted by Alex (support) on Jun 05, 2009 00:53 Hello, the provided code looks correct. What issue have you faced ? Answer posted by Roger W. Barros on Jun 05, 2009 08:50 The ajax to change the content of "<span id=span_cities>" the dhtmlxcombobox no longer recognizes him How do dhtmlxcombobox with dynamic content? Answer posted by Support on Jun 05, 2009 09:18 You need to call next block of lines var cities = dhtmlXComboFromSelect("cities"); cities.readonly(1); cities.enableOptionAutoHeight(1); from ajaxGet callback, so each time, when second area reloaded - second combo will be initialized from new data. Actually you can replace ajaxGet with native method of combo function onChangeFuncNewCities() { cities.loadXML("cities.php?for="+state.getComboValue()) ; //load xml data with new list of values for combo } |