FWD: target query

kenboss kenboss at dilbert.dnr.state.mn.us
Mon Dec 11 12:11:04 EST 2000


Maybe the formatting of my original response was a little misleading.

In your html template file, your browsable/queryable map is embedded in a form.  
For example, the mapserver demo uses:

<form method=GET action="/cgi-bin/ms_3.3">

to begin the form definition.  You want to expand this to something like:

<form method=GET action="/cgi-bin/ms_3.3" name="mapserv" onSubmit="toFrame()">

Then, in the <head> portion of the template, add your javascript function, like:

<script language="JavaScript">
function toFrame() {
  if (document.mapserv.mode.value == "query" || document.mapserv.mode.value == 
"nquery") {
    document.mapserv.target = "queryFrame";
  } else {
    document.mapserv.target = "_self";
  }
}
</script>

Note that the "mapserv" part of document.mapserv.target is the name attribute of 
the form as defined above, you can change it to whatever suits you.  
"queryFrame" is the name attribute of a frame as defined in your frameset.  
"_self" is a keyword that will send results to the same frame the contains the 
form.  If you want to send results to a separate window, you will need 
additional code to specify window attributes and open the window.

You can find lots of good JavaScript resources online.  Try 
http://developer.netscape.com/tech/javascript/index.html for starters.

Hope this helps,

--Ken


> Date: Mon, 11 Dec 2000 10:00:13 -0600 (CST)
> From: teb <teb at mallit.fr.umn.edu>
> Subject: FWD: target query
> To: mapserver-users at lists.gis.umn.edu
> Cc: astender at crl02.crrel.usace.army.mil
> MIME-Version: 1.0
> Content-MD5: MhicjKLEgtk5EXyxMcCW8w==
> 
> 
> ------------- Begin Forwarded Message -------------
> 
> From: "Stender, Amy ERDC-CRREL-NH" <astender at crl02.crrel.usace.army.mil>
> To: "'mapserver-info at lists.gis.umn.edu'" <mapserver-info at lists.gis.umn.edu>
> Subject: target query
> Date: Mon, 11 Dec 2000 10:59:09 -0500
> MIME-Version: 1.0
> 
> I read the reply Ken Boss gave to "different target frames based on mode"
> and am still having trouble sending the query template to a specific frame
> on a webpage. I'm new to JavaScript and attempeted using
> 'onSubmit="toFrame()"' by my query info on my html page and creating a
> 'toFrame()' JavaScript function to use the script Ken gave. If someone could
> explain how I can send my query template to a frame and/or even a new
> window, I'd appreciate it very much.
> 
> Thanks,
> Amy
> 
> ------------- End Forwarded Message -------------
> 
> 




More information about the mapserver-users mailing list