Categories | Question details Back To List | ||
Combobox, problem in second time Hi Support I have two select box on the jsp page. If I select any value from my first drop down box, the second box will be populated based on the value of first box.. Now I want my second box to be made editable, for this I am trying to use your dhtmlx combo. When first time I am selecting value from the first box, second box is getting populated, but when again I change the value of the first box, second box is not getting populated. Here is the code: <td align="left" valign="middle"> <nested:select property="fieldName1" style="width:150px" styleId="fieldName1"> <option value="">Select Field</option> <nested:optionsCollection property="fieldNameList" value="value" label="key"></nested:optionsCollection> </nested:select> <script> var d=dhtmlXComboFromSelect("fieldName1"); d.attachEvent("onChange",function(){populateValues(this,d.getSelectedValue());}); </script> </td> function populateValues(fname,fvalue) { …….. ……… ……. ………… var cwList=dhtmlXComboFromSelect("fieldValue1"); ……….. …….. …….. …….. } <td align="left"> <nested:select property="fieldValue1" name="reportForm" style="width:162px" styleId="fieldValue1"> <nested:optionsCollection property="fieldValueList1" value="value" label="key"></nested:optionsCollection> </nested:select> </td> Javascript fails second time after var cwList=dhtmlXComboFromSelect("fieldValue1"); this line . I think second time it is not able to create the object. Its showing the following error in the IE browser “null is null or not an object”. Please help me in sorting out this issue. Answer posted by Support on Jul 10, 2008 05:43 >>I think second time it is not able to create the object. Its showing the following error in the IE browser yes, the select box instance already converted to dhtlmxCombo and second call will cause an error. The dhtmlXComboFromSelect can be used only once per select box, after that you may interact directly with combo object ( adding|deleting options, loading options set from XML and etc. ) but you can't operate with source select box control, it is fully removed from DOM. In you case, the correct solution will be call dhtmlXComboFromSelect initially and manipulate with options inside combo in populateValues method. |