Enable/disable a group of layers (workaround)

Berend Veldkamp berend.veldkamp at aris.nl
Fri Apr 21 10:43:48 EDT 2000


OK, I found a workaround myself, using JavaScript:

<SCRIPT LANGUAGE="JavaScript"><!--

function CreateCheckBox (layername)
{
  theLayers = "[layers]";
  if ((theLayers.length > 0) && (theLayers.indexOf (layername) > -1))
    theResult = " checked";
  else
    theResult = " ";
  theResult = "<INPUT type=checkbox name=layer value=" + layername +
theResult + "> ";
  document.write (theResult);
}

//--></SCRIPT>

and in my HTML code:

....

<SCRIPT LANGUAGE="JavaScript"><!--
      CreateCheckBox ("allroads");
//--></SCRIPT>
All Roads<BR>

....

Still, there must be a better way...
Berend


Berend Veldkamp wrote:

> Here's a question concerning groups of layers.
> What I'm trying to do, is to enable/disable a group of layers with one
> checkbox. When I do this with a separate layers, there's no problem,
> this works:
>
> <INPUT type="checkbox" name="layer" value="road1" [road1_check]>Minor
> Roads<BR>
> <INPUT type="checkbox" name="layer" value="road2"
> [road2_check]>Highway<BR>
> <INPUT type="checkbox" name="layer" value="road3" [road3_check]>Other
> Roads<BR>
>
> When I group multiple layers in a group (in my .map file), it works as
> well, but the checkbox is always unchecked after the map is drawn.
>
> <INPUT type="checkbox" name="layer" value="allroads"
> [allroads_check]>Roads<BR>
>
> Any ideas, anyone?
> TIA, Berend
>
> --

--





More information about the mapserver-users mailing list