Controlling mapsize in CGI

Steve Lime steve.lime at DNR.STATE.MN.US
Fri Mar 11 17:11:53 EST 2005


You don't want to escape the space in a select list like this. Turn the
+ into whitespace and it should work fine. Otherwise the browser escapes
the + and MapServer actually see's it which causes the parsing error.

Steve

>>> Jacob Delfos <jacob.delfos at MAUNSELL.COM> 3/10/2005 11:44:54 PM >>>
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



More information about the mapserver-users mailing list