Computer and Internet » Programming » Javascript
Populate SELECT Tag with Dojo and CakePHP
At FireFox you can use
selectTag.innerHTML = textLoadedWithXHR
to populate a select input. Intenet Explorer doesn't support that feature! It's a bug as you can see in the Microsoft KB.
I used JSON support and Dojo to populate an existing select input with new options.
Check out the following Javascript code:
var sel = document.getElementById("selectTag");
//delete old entries
while (sel.length > 0)
sel.options[sel.length-1] = null;
for (var key in json)
{
var value = json[key];
var opt = new Option(value, key);
sel.options[sel.length] = opt;
}
Tags: -
Related entries:
- Right Character Encoding with CakePHP and Dojo Toolkit
- Dojo Widget Cheat Sheet
- How can i set Aptana to correctly highlight my .thtml templates from CakePHP
- How can I check to see whether a trigger exists and if it exists then delete it ?
- How to remove the emulated Ethernet Virtual PC Switch?
Last update: 2006-10-20 18:58
Author: Christian Trummer
Revision: 1.0
You cannot comment on this entry