Hello everyone,
I have the following code that builds <option> into a <select>.
buildModel() is called first, then setModel().
For some reason, I can''t get the length of the "model"
options in
setModel(), but can after they are built in buildModel();
function buildModel(originalRequest, json) {
var model = $(''model'');
//might need to clear options
//model.options.length = 0;
$H(json).each(function(node){
model.options[model.options.length] = new Option(node[0], node[1]);
});
alert(model.options.length); // alerts the proper length
}
function setModel(smodel) {
var model = $(''model'');
alert("inside setModel length is: " + model.options.length);
//length is zero
for (var i=0, len=model.options.length; i<len; ++i) {
if (model.options[i].value == smodel) {
model.selectedIndex = i;
}
}
}
Any ideas what could be causing this?
Thanks for any help,
Kevin
--
Kevin Old
kevinold-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org