View Single Post
Old 08-13-2010, 11:15 AM   PM User | #1
developer-si
New to the CF scene

 
Join Date: May 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
developer-si is an unknown quantity at this point
Internet Explorer fill select (drop down) element dynamically

Hello everyone!

I have a select (combo box) element that gets filled with items when selected item changed in another one (master combo box). It works in Chrome, FireFox but not in IE (all latest browser versions).

How do I populate the items in the child combo box:
- ajax call of a PHP script
- that returns items for the combo box: echo '<option value="' . $id . '">' . $name . '</option>';
- setting innerHTML attribute of the child combo box to a value that gets returned by the ajax call: document.forms['parametersForm'].elements['stationId'].innerHTML = html;

Do I need to return JSON object (or XML) by the PHP script and programically add items (in JavaScript) in the ajax callback or is there an alternative? Obviously building DOM with echoing PHP result doesn't work well in IE.

Thanks for your future help!

Regards
developer-si is offline   Reply With Quote