The following script is supposed to have high categories as radio
buttons and mid categories as check boxes. Clicking the radio button
is supposed to select all checkboxes under it and submit the form.
RADIO (ID = 0001-1 VALUE="")
CHECK (ID=0001-0011)
CHECK (ID=0001-0012)
RADIO (ID = 0001-2 VALUE="")
CHECK (ID=0001-0021)
CHECK (ID=0001-0022)
The code appears to be checking and unchecking the correct checkboxes.
But when the submit occurs, the buttons that were unchecked become
checked again.
function handleHighCatSe lect(obj)
{
var highCatName = obj.name;
var highCatNameInMi dCat = highCatName.sub string(0,5) + "00" +
highCatName.sub string(5,6);
alert(highCatNa me);
var length = document.frm.el ements.length;
for (var i=0;i<length;i+ +)
{
var formObj = document.basicS earchMFSFrm.ele ments[i];
var currName = formObj.name;
var currValue = formObj.value;
if ((formObj.type == 'radio' || formObj.type == 'checkbox')
&& (currName.index Of('0001-') != -1) )
{
if ((currName.inde xOf(highCatName InMidCat) != -1) ||
(currName == highCatName ) )
{
formObj.checked = true;
}
else
{
formObj.checked = false;
}
}
}
frm.submit();
}