Forum Discussion

Re: Button to open Code Page and pass record data to Code Page

It works on my end, but results in an endless loop of page reloads. I have to close the page to get it to stop.

@Sharon Faust and @Ryan Pflederer any suggestions?

------------------------------
Adam Keever
------------------------------

2 Replies

  • QuickBaseJunkie's avatar
    QuickBaseJunkie
    Icon for Qrew Legend rankQrew Legend
    @Adam Keever I know we're also discussing the Slack channel, but I didn't want to leave this post hanging.
    ​
    I would suggest passing your desired redirect as part of the URL and using it in place of the referrer... which should help with the loop. (I'm using chrome, and have not experienced a looping issue with the code)

    Also, this is only intended to use with a previously saved record as it needs the Record ID to function.

    Something along the lines of this:

    FORMULA - URL:
    URLRoot() & "db/" & AppID() & "?a=dbpage&pageid=17" & // code page
    "&url=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=printr&dfid=10&rid=" & [Record ID#]) & //passed to code page for print window
    "&rdrurl=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#])//passed for final redirect

    CODE PAGE:
    <!DOCTYPE html>
    <html>
    <head>
    <script>
    var urlParams = new URLSearchParams(window.location.search);
    var url = urlParams.get('url');
    var rdrurl = urlParams.get('rdrurl');
    window.open(url,'Print','width=800,height=700');
    window.location.href = rdrurl;
    </script>
    </head>
    </html>


    ------------------------------
    Sharon Faust (QuickBaseJunkie.com)
    Founder, Quick Base Junkie
    https://quickbasejunkie.com
    ------------------------------
    • AdamKeever1's avatar
      AdamKeever1
      Qrew Commander
      @Sharon Faust thanks for the feedback. I use Chrome too. Once I killed the page in which I pressed the button, the print window stopped refreshing. I appreciate your suggestion.

      ------------------------------
      Adam Keever
      ------------------------------