[Cartoweb-users] query table

Oliver Christen oliver.christen at camptocamp.com
Wed Jul 19 03:08:22 EDT 2006


ok, it was some javascript problems:
- its not innerhtml, its innerHTML
- popuppage refer to a variable name, not the new popup name
and possibly window.onload is not already declared

replace your code with this:

 myContent = document.getElementById("result").innerHTML;
        popuppage = window.open('', 'popuppage','toolbar=no,location=no,status=no,menubar=no,resizable=yes,scrollbars=yes,copyhistory=no,width=300,height=400');
         
Also you may have to change "window.onload += function() {" by "window.onload = function() {" if nothing happens

Oliver
  When I do a query it fills the div and the var result = 1. I don't have javascripts error. But there's no popup....


  2006/7/19, Oliver Christen < oliver.christen at camptocamp.com>:
    This goes in the cartoclient.tpl so you did it right.

    now, when you do a query, it should fill the <div> with a table of results. It will not be displayed on your screen but you can see it if you look at the source of the page (View->Page Source in your browser)

    So, do you see the table result in the source? You can try to temporarily remove the style="display:none;" so you can the result on your page

    If you have a table of result, it should now activate the javascript when the page load. If you look at the page source, you should find "var result = 1;"
    If you see "var result = 0" then there was no result to your query and the <div> should be empty too.

    If "var result = 1;", do you have any javascript errors reported in your browser? If yes, what is the error message.

    Oliver


      I put that part into the head of the cartoclient template:

       <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',
      'toolbar=no,location=no,status=no,menubar=no,resizable=yes,scrollbars=yes,co 
      pyhistory=no,width=300,height=400');
               popuppage.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
      4.01//EN""http://www.w3.org/TR/html4/strict.dtd ">'+
                  '<html><head><title>My window</title></head><body>' + myContent
      + '</body></html>')       }
          }
          {/literal}
          //-->
        </script>

      and i put these part in the body of the file

      <div id="result" style="display:none;">
                    {$tables_result}
       </div>

      In fact I don't really know where I should put theses files except the first that has to be in the head of an html file. 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20060719/f999007d/attachment.html


More information about the Cartoweb-users mailing list