Controlling mapsize in CGI

Jacob Delfos jacob.delfos at MAUNSELL.COM
Thu Mar 10 21:44:54 PST 2005


Richard,

Try putting something like this inside your form:

<SELECT NAME='map_size' ID='mapsize'>
<OPTION VALUE="600+300">600 x 300
<OPTION VALUE="800+400">800 x 400
</SELECT>
Then have a bit of javascript like this:


<script>
function onLoadFunction ()
{ 

urlstring = location.href;
   if (urlstring.match("600+300") != null)
   {
   document.forms[0].map_size.value = "600+300";
   }
   else
   {
      if (urlstring.match("800+400") != null)
      {
      document.forms[0].map_size.value = "800+400";
      }
   }

}
</script>

Make sure the body has something like:

            <body onload="onloadFunction()">

I have not really tested this code, but it should work. It basically puts in a dropdown selector for the mapsize form variable. When the page is loaded, the javascript checks out the URL, searching for the value of the map_size. Make sure there are no other form variables with similar values, because it might pick those up too. It sets the dropdown box to the value it found in the URL.

Let me know if you have any troubles.

Jacob



-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of Richard A. Milewski
Sent: 11 March 2005 13:29
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] Controlling mapsize in CGI

Stephen,

Thank you for the speedy reply!  I don't have any trouble setting the size
in the querystring, that works reliably.  The problem is in showing a
checkbox or the default value in a drop-down box that shows the current
setting. How do I handle the problem on the cgi/html side.

Thanks!

-- Richard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20050311/cdfdbc34/attachment.htm>


More information about the MapServer-users mailing list