Hello,

I've spent a few hours trying to understand this strange behaviour:

I have 1 test layer (and hence only 1 test group), almost everything was set 
to defaults.

Procedure in firefox:

- Clicking on the checkbox in the toc unchecks it and refresh the map with no 
layers loades (map is blank), as expected
- Clicking again on the checkbox, reloads the map but DO NOT LOAD ANY LAYER.

This happens because in javascript/mapserver.js line 336

    for (var i=0; i<parent.tocFrame.document.layerform.groupscbx.length; i++) 

parent.tocFrame.document.layerform.groupscbx.length is undefined if there is 
just one htmlinput element.


Adding an "if" check solved the problem for me:
-----------------------------------------------

function getLayers() {
    var layerstring = "&groups=";
    if(parent.tocFrame.document.layerform.groupscbx.length){
    for (var i=0; i<parent.tocFrame.document.layerform.groupscbx.length; i++) 
{
            if (parent.tocFrame.document.layerform.groupscbx[i].checked == 
true) {
                layerstring += 
parent.tocFrame.document.layerform.groupscbx[i].value+'+';
        }
    }
    } else {
      if (parent.tocFrame.document.layerform.groupscbx.checked == true){
        layerstring += parent.tocFrame.document.layerform.groupscbx.value+'+';
      }
    }

    layerstring = layerstring.substr(0, layerstring.length - 1);
    return layerstring;
}


-- 
Alessandro Pasotti
ICQ# 245871392
Linux User #167502


Reply via email to