[mapserver-users] mapserver+javascript without template example?!!!

Saka Royban sakaroyban at yahoo.com
Sun Sep 9 22:46:25 PDT 2012


Thanks for your help
I changed my file to follows:
</head>
    <script language="JavaScript">
        function zoom(){
            document.forms['mapserv'].submit();
        }
    </script>
<body>
<h1> A Dynamic Map </h1>
<p></p>
<h3> use form to make map dynamic + scripting </h3>
    <form name="mapserv" method="get" action="/cgi-bin/mapserv.exe">
        <input type="hidden" name="imgxy" value="[center]">
        <input type="hidden" name="map" value="[map]" />
        <input type="hidden" name="imgext" value="[mapext]" />
        <input type="hidden" name="layers" value="[layers]" />    
        <input type="hidden" name="mode" value="map" />

        <input type="hidden" name="zoomsize" value="2" />
        
        <input type="image" name="img" src="http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/ms101/htdocs/ms101.map&layers=all&mode=map"  onclick="zoom()"/>

    </form>

</body>
<html>

If i click on image, i get a response from mapserver correctly. In fact, in loading the above page, mapserver properly fills variables like [map]. This is the url after clicking map:
http://localhost/cgi-bin/mapserv.exe?imgxy=400+200&map=%2Fms4w%2Fapps%2Fms101%2Fhtdocs%2Fms101.map&imgext=-180+-90+180+90&layers=[layers]&mode=map&zoomsize=2&img.x=228&img.y=108


But when i remove <input type="hidden" name="imgxy" value="[center]">, mapserver does not substitutes any variable.

this is the url after clicking map:
http://localhost/cgi-bin/mapserv.exe?map=[map]&imgext=[mapext]&layers=[layers]&mode=map&zoomsize=2&img.x=618&img.y=160

Why MapServer behaves like this? (useful for mentioning, there is no template defined in map file)


----- Original Message -----
From: Alan Boudreault <aboudreault at mapgears.com>
To: mapserver-users at lists.osgeo.org
Cc: 
Sent: Monday, September 10, 2012 5:58 AM
Subject: Re: [mapserver-users] mapserver+javascript without template example?!!!

You should verify what exact request is sent to the server... I would 
assume something like "map=[map]" is sent. Use Firebug of any other 
debugging tool.

Alan

On 12-09-09 01:54 PM, Saka Royban wrote:
> Hi all.
> I'm just looking for some examples of using javascript with mapserver
> without using html templates.
> I know that there are some libraries around like OpenLayers, but i wanna
> see what happens in background first and then move to use these libraries.
> This is what i have written which does not works: (i get a error saying
> MS_DEFAULT_MAPFILE_PATTERN validation failed )
> <html>
> <head>
> </head>
>      <script language="JavaScript">
>          function zoom(){
>          document.forms['mapserv'].imgxy.value = "400 200";
>          document.forms['mapserv'].zoom.value = 2;
>          document.forms['mapserv'].submit();
>
>          }
>      </script>
> <body>
> <h1> A Dynamic Map </h1>
> <p></p>
> <h3> use form to make map dynamic + scripting </h3>
>      <form name="mapserv" method="GET" action="/cgi-bin/mapserv.exe">
>          <input type="hidden" name="imgxy" value="400 200">
>          <input type="hidden" name="map" value="[map]" />
>      <input type="hidden" name="imgext" value="[mapext]" />
>          <input type="hidden" name="imgxy" value="[center]" />
>          <input type="hidden" name="zoomsize" value="2" />
>
>          <input type="image" name="img"
> src="http://localhost/cgi-bin/mapserv.exe?map=/ms4w/apps/ms101/htdocs/ms101.map&layers=all&mode=map"
> onclick="zoom()"/>
>
>      </form>
>
> </body>
>
> Thanks in advance
> <html>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>


-- 
Alan Boudreault
http://www.mapgears.com/
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20120909/16e91f6b/attachment.html>


More information about the mapserver-users mailing list