Forum Discussion

ChrisNewsome's avatar
ChrisNewsome
Qrew Captain
4 years ago

Open Print dialog when clicking "print exact form" button

Ok, I've gotten this to work with regular forms before, but I cannot get this to work with an exact form. I have a button to open the form in a new window and, on regular forms, it automatically fires the print dialog. However, trying the same syntax does not work with the exact forms button. Here is what my code looks like:

URLRoot() & "db/" & Dbid() & "?a=dbpage&pagename=" & URLEncode("Work Order Cover Sheet .html") & "&clist=a&apptoken=XXX&rid=" & "?a=printr&rid=" & [Record ID#]​


Of course I've XXX'd out the app token above. (it doesn't even require them, but this button was auto-generated) Any ideas why this won't work?



------------------------------
Thanks,
Chris Newsome
------------------------------

2 Replies

  • BradLemke's avatar
    BradLemke
    Qrew Assistant Captain
    The only way I managed to get the print dialog to auto-open for an exact form that I created was, I believe, to embed it into the html of the page after the initial upload.

    Unfortunately, this would tell chrome to generate a printable version of the page while it was still processing - leading to a page full of field tags (~x~) instead of the data.  

    It was about a year or so ago that I left well-enough alone on it, but it couldn't hurt to explore it again.  I'll let you know what I find out.

    ------------------------------
    Brad Lemke
    ------------------------------
    • BradLemke's avatar
      BradLemke
      Qrew Assistant Captain
      Insert this code into your exact form anywhere in the <body> section, possibly best results at the very bottom:
      <script>
      setTimeout(function() {this.print()},3000);
      </script>

      This will call up the print function after 3,000ms (3 seconds).  You can increase or decrease that number as needed if there are a bunch of images/tables that need to be generated before calling the print function.

      ------------------------------
      Brad Lemke
      ------------------------------