[mapserver-users] Refresh via javascripts

Martin Weinelt mweinelt at planiglobe.com
Tue Jul 16 03:43:04 EDT 2002


YC Nyon on Montag 15 Juli 2002 08:13:
> When the checkbox of a layer is change, using the onclick command, it will
> run the following javascript commands
> function redraw()
> {
>  document.mapper.zoom.value = 0;
>  document.mapper.zsize.value = 0;
>  document.mapper.extent.value;
>  document.mapper.map_x.value = 225;
>  document.mapper.map_y.value = 175;
>  document.mapper.submit();
> }
>
> It works except it displays the full extent of the map.
> In my file, there is the <input type=hidden name=extent ...> which defines
> the current map extent.
>
> Seems i missing something..
>
> Nyon

Nyon,

I use two forms for the interface (also because I use different frames). 
One takes care of pan, zoom, query and one does
the layers update. In the first form there is the line from the demo reading:
 <input type="hidden" name="imgext" value="[mapext]">

When the user hits the refresh button in the second form (layers), the js routine 
(among other things) copies the 'imgext' value from the first form:
    with (parent.frBottom.document) {
      myForm.imgext.value = map_form.imgext.value
    }
where frBottom is the frame the Mapserver CGI sends the map, myForm is
the 'layers'-form and map_form is the form template mapserver uses.

View he whole thing at : http://www.costarica.geomar.de/demo_pif/

Cheers, Martin



More information about the mapserver-users mailing list