MapTools.org

[rosa-users] query result in a new popup

Daniel Morissette morissette@dmsolutions.ca
Sun, 23 Mar 2003 09:45:15 -0500
Daniel Wagner wrote:
> 
> I've integrated a Query-Button into the rosa applet and now I want to show the
> query-result in a new popup.
> 
> I set the query-button with the "TB_BUT_info_JSACTION"-param to the following
> JavaScript-function:
> 
> function info (){
>         window.open("[program]","Info","width=600,height=400.......");
> }
> 
> But in the generated popup appears the following error message:
> 
> No query information to decode. QUERY_STRING is set, but empty.
> 


This happens because the URL you provide to window.open() is just the
mapserv URL, without the form parameters.  You have two possibilities:

1- Modify your info() function to construct a valid mapserv URL that
includes all your form parameters.  You would have to do that yourself
in JavaScript: read the value of each form parameter and append them to
the URL.  Then pass that URL to window.open().


2. It may be possible to redirect the form to the window after it's
opened using something like this:
  
 function info (){
    // Create a window pointing to an empty dummy.html page.
    // Make sure dummy.html exists to prevent 404 errors
    window.open("dummy.html","Info","width=600,height=400.......");

    // Set the form target to the new window and submit it.
    document.form[0].target = "Info";
    document.form[0].submit();

    // Reset the form target so that further submits will go to 
    // the main window
    document.form[0].target = "";
 }


Note that this code may not run as is, I barely ever use JavaScript
myself so I could have made some mistakes, but I'm quite sure that the
JavaScript gurus in our team have used this trick before.

Daniel
-- 
------------------------------------------------------------
 Daniel Morissette               morissette@dmsolutions.ca
 DM Solutions Group              http://www.dmsolutions.ca/
------------------------------------------------------------


This archive was generated by Pipermail.