Thanks for the report. It probably never happened to me because I never
used only 1 group, what in fact is not very likely. I will modify the JS
code (that is one of the oldest parts, I guess, something from the very
beginning...) for the next versions.
armin
Alessandro Pasotti wrote:
> 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;
> }
>
>