High_D
June 24th, 2008, 10:54 AM
Any idea how can I figureout the calling objects ID in my javascript function? I've got some custom validators assigned to run this client script, and each is tied to the ID of a listbox.
How in the function do I figureout the ID of the box I want to loop through?
listBoxValidator.ID = "Validator" + idPostFix;
listBoxValidator.ClientValidationFunction = "ListItemsValidate";
listBoxValidator.ValidateEmptyText = true;
listBoxValidator.ErrorMessage = "Only 8 Items may be selected";
listBoxValidator.Display = ValidatorDisplay.Dynamic;
listBoxValidator.ControlToValidate = ListBox1.ID;
function ListItemsValidate(source, arguments)
{
var iSelectedCount = 0;
var listbox = document.getElementById(?????)
for(var i = 0, max = listbox.length; i < max; ++i)
{
if(listbox[i].selected)
iSelectedCount = iSelectedCount + 1;
}
if (iSelectedCount < 8)
arguments.IsValid=true;
else
arguments.IsValid=false;
}
Any ideas :confused:
How in the function do I figureout the ID of the box I want to loop through?
listBoxValidator.ID = "Validator" + idPostFix;
listBoxValidator.ClientValidationFunction = "ListItemsValidate";
listBoxValidator.ValidateEmptyText = true;
listBoxValidator.ErrorMessage = "Only 8 Items may be selected";
listBoxValidator.Display = ValidatorDisplay.Dynamic;
listBoxValidator.ControlToValidate = ListBox1.ID;
function ListItemsValidate(source, arguments)
{
var iSelectedCount = 0;
var listbox = document.getElementById(?????)
for(var i = 0, max = listbox.length; i < max; ++i)
{
if(listbox[i].selected)
iSelectedCount = iSelectedCount + 1;
}
if (iSelectedCount < 8)
arguments.IsValid=true;
else
arguments.IsValid=false;
}
Any ideas :confused: