[Cartoweb-users] About Query

Pierre GIRAUD pierre.giraud at camptocamp.com
Thu Jun 16 11:53:19 EDT 2005

You should take care of 2 things.

First, please take advantage of the X library :


should better be written :

var result = xGetElementById("result");
result = xInnerHtml(result);

Then, you'll have troubles using window.onload. You must note that it's 
not possible to have several window.onload in the same html.
To do that, an "onLoadString" is evaluated in a unique window.onload.
Then, you'll have to concatenate onLoadString, with your scripts (don't 
forget to use semi-colon ";").

For example :

onLoadString += 'alert "the HTML window is loaded";';



>One possibility i see, before trying to modify the php, would be to set a
>javascript variable in the template via smarty and use a javascript function
>to launch a popup depending of the value.
>Leave the query result in your main page but in a hidden element, then copy
>the content of that hidden element in the popup via javascript.
>something like :
>in your main page header:
><script language="JavaScript" type="text/javascript">
>    <!--
>  var result = "{if $tables_result|default:'0'}'1'{/if}";
>  {literal}
>    window.onload = function() {
>      if (result == "1") {
>        myContent =  document.getElementById("result").innerhtml;
>        window.open('', 'popuppage',
>         popuppage.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
>            '<html><head><title>My window</title></head><body>' + myContent
>+ '</body></html>')       }
>    }
>    {/literal}
>    //-->
>  </script>
>in the body:
><div id="result" style="display:none;">
>              {$tables_result}
> </div>
>this is untested but it may work ^^
>Oliver Christen
>>I would like that the results of the requests appear in a new page, style
>>Should I modify a template?  Or is it necessary to modify the php code of
>>one of the plugins query, Mapquery or Tables?
>>Thanks for your answers !
>>Fred B
>Cartoweb-users mailing list
>Cartoweb-users at lists.maptools.org

More information about the Cartoweb-users mailing list