PDA

View Full Version : simple question - "object expected"


CoolnessItself
02-17-2003, 05:22 PM
Take a look at http://coolnessitself.www2.dotnetplayground.com/educonnect/index.html
(and view the source)
When you click either add or remove, I get the error "object expected". How do I call those two javascript functions without getting that error?

beetle
02-17-2003, 05:48 PM
Your add/remove function have colons and periods where they should have underscores.

Redo your functions like this...function tchWizardStudentsAdd()
{
var f = document.theform;
var chosen = f.elements['ecContent_ecModuleTeacher_lstWizardStudentsChosen'];
var available = f.elements['ecContent_ecModuleTeacher_lstWizardStudentsAvailable'];
var option = available.options[available.selectedIndex];

var opt = new Option( option.text, option.value );
chosen.options[chosen.length] = opt;
}

function tchWizardStudentsRemove()
{
var chosen = document.theform.elements['ecContent_ecModuleTeacher_lstWizardStudentsChosen'];
chosen.options[chosen.selectedIndex] = null;
}