Hello All,
I am facing a very small problem on Dependent List box please try help me.
I have a dependent list box one Job_Type and second is Department when user in Insert Mode its working fine but when user goes to edit mode and click on directly to department listbox its showing all the values.
How can eliminate this thing?
I tried to set Javascript function to department "OnFocus" but this will refresh the list on first click in IE.
I used Below Javascript code :
onfocus="set_child_listbox(job_type, department, Product);"
function set_child_listbox(parentObject, childObject, childArray)
{
//Clear child listbox
for(var i=childObject.length;i>0;i--)
{
childObject.options = null;
}
childObject.options[0] = new Option("Select Department","-1");
var sel_index = parentObject.options[parentObject.selectedIndex].value;
if (sel_index == "")
{
childObject.disabled = true;
}
else
{
childObject.disabled = false;
var childIndex = 1;
for (i =0; i < childArray.length; i++) {
if (childArray[0] == sel_index) {
childObject.options[childIndex] = new Option(childArray[2], childArray[1]);
childIndex++;
}
}
}
//Select first option
childObject.selectedIndex = 0;
}
<!-- BEGIN Grid job_type -->var Product = new Array(
<!-- BEGIN Row -->new Array({parent_id},{job_type_id},"{job_type}")<!-- END Row -->
<!-- BEGIN Separator -->, <!-- END Separator -->);
<!-- END Grid job_type -->
</script>