Forum Discussion

AdamKeever1's avatar
AdamKeever1
Qrew Commander
5 years ago

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

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

Can anyone share a method to do this? I have a custom form that works great for creating new records. I want to be able to give the users the ability to then view that record in the same format that they entered the record. I know this is possible with javascript, but is this possible without javascript?

------------------------------
Adam Keever
------------------------------
  • Here you go! I plan to make a video on this topic soon. 

    This particular formula/code page passes a URL to display a specific form to a pop-up print window, then returns the user to the page they were on.

    This would replace the 'onclick' use in a rich text formula field. Additional parameters (name=value) can be passed they just need to be separated with a "&".

    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

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

    Let me know if this works for you 👍

    ------------------------------
    Sharon Faust (QuickBaseJunkie.com)
    Founder, Quick Base Junkie
    https://quickbasejunkie.com
    ------------------------------
    • AdamKeever1's avatar
      AdamKeever1
      Qrew Commander
      @Sharon Faust, thanks so much for posting this. I am going to see if I can get it functioning on my end.​

      ------------------------------
      Adam Keever
      ------------------------------
      • AdamKeever1's avatar
        AdamKeever1
        Qrew Commander
        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
        ------------------------------