[Chameleon] javascript to turn on a layer worked!!! but...

JR Santillan dgr8_39991 at yahoo.com
Wed Mar 15 03:49:45 EST 2006


Hello there again.

I tried the script Julien posted and I found out that the script will only work if the visibility in the LegendTemplate widget is set to "true"... and  if the "checkboxes" in the legend_template.html file is included...

However, the primary reason why I wanted to use a javascript is to avoid displaying the legend in my application that will also avoid the checking and unchecking of the layers in the legend.

Any help out there to work this out?

Thanks again.


Jojin


Julien-Samuel Lacroix <jlacroix at mapgears.com> wrote: Hello,
Your funciton should look like:

     function becomeAerial()
     {
         for(i=0;document.forms[0].elements['legendlayername[]'][i];i++)
         {
 
if(document.forms[0].elements['legendlayername[]'][i].value=="Aerial")
             {
 
document.forms[0].elements['legendlayername[]'][i].checked=true;
             }
         }
         document.forms[0].submit();
     }

Note that:
- the forms take an 's'
- the access to form elements with '[]' in the names is special.
- in the if() statement, the value should be equal (==) to "Aerial" not 
differ!  ent  (!=).

Julien

   

---------------------------------
 Yahoo! Mail
  Use Photomail to share photos without annoying attachments._______________________________________________
Chameleon mailing list
Chameleon at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/chameleon


			
---------------------------------
 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20060315/6185716f/attachment.html


More information about the Chameleon mailing list