Hello,
Although the problem title may give you a "duh!!" reaction it isn't thát simple (for me)... I need a function in which I can handle different form names. I already know the function does the job it is supposed to do, but only when it a static form name. The function is as follows:
function UpdateDropDown(id)
{
var e = id;
data = GetOptions(e);
var j = 1;
// clear down the dropdown before adding new entries into it.
document.form.DivisieID.options.length = 0;
for (var i=0; i < data.length; i++)
{
if (data == 'RETURN')
{
return true;
}
document.form.DivisieID.options[j]=new Option(data, data);
j++;
}
return true;
}
This is the working form and my idea was somthing like this:
function UpdateDropDown(thisForm, id)
{
var e = id;
data = GetOptions(e);
var j = 1;
// clear down the dropdown before adding new entries into it.
document.thisForm.DivisieID.options.length = 0;
for (var i=0; i < data.length; i++)
{
if (data == 'RETURN')
{
return true;
}
document.thisForm.DivisieID.options[j]=new Option(data, data);
j++;
}
return true;
}
In this function 'thisForm' should be the variable form name e.g. form1, form2 etc... I call this function as follows:
onChange="Javascript:UpdateDropDown('form" & Counter & "', document.form"&Counter&".SpecialismeID.options[document.form"&Counter&".SpecialismeID.selectedIndex].value)";
Another idea I tried is this:
field = "document."+thisForm+".DivisieID";
field.options.length = 0;
But I don't seem bright enough.... Help!
Any suggestions?
Don't eat yellow snow!
Although the problem title may give you a "duh!!" reaction it isn't thát simple (for me)... I need a function in which I can handle different form names. I already know the function does the job it is supposed to do, but only when it a static form name. The function is as follows:
function UpdateDropDown(id)
{
var e = id;
data = GetOptions(e);
var j = 1;
// clear down the dropdown before adding new entries into it.
document.form.DivisieID.options.length = 0;
for (var i=0; i < data.length; i++)
{
if (data == 'RETURN')
{
return true;
}
document.form.DivisieID.options[j]=new Option(data, data);
j++;
}
return true;
}
This is the working form and my idea was somthing like this:
function UpdateDropDown(thisForm, id)
{
var e = id;
data = GetOptions(e);
var j = 1;
// clear down the dropdown before adding new entries into it.
document.thisForm.DivisieID.options.length = 0;
for (var i=0; i < data.length; i++)
{
if (data == 'RETURN')
{
return true;
}
document.thisForm.DivisieID.options[j]=new Option(data, data);
j++;
}
return true;
}
In this function 'thisForm' should be the variable form name e.g. form1, form2 etc... I call this function as follows:
onChange="Javascript:UpdateDropDown('form" & Counter & "', document.form"&Counter&".SpecialismeID.options[document.form"&Counter&".SpecialismeID.selectedIndex].value)";
Another idea I tried is this:
field = "document."+thisForm+".DivisieID";
field.options.length = 0;
But I don't seem bright enough.... Help!
Any suggestions?
Don't eat yellow snow!