Forum Discussion

MrunaliKadam's avatar
MrunaliKadam
Qrew Trainee
2 years ago

Include/add pdf flyer on the form

Hi,

I've created a pdf which has instructions for user so they can successfully submit the form. Now looking for solution/ideas to include this pdf flyer on the form. 

Please advise.

------------------------------
Mrunali Kadam
------------------------------

5 Replies

  • Do you want to embed the PDF on the form or have a link to it?

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • MrunaliKadam's avatar
      MrunaliKadam
      Qrew Trainee
      Want to embed the pdf..

      ------------------------------
      Mrunali Kadam
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        This should get you started. It my own cheat notes which you can adapt.


        Step 1.

        Create a Code page called iframe.html
        <html>
        <head><title></title></head>
        <body>

        <iframe id="kirk" style="height:100%;width:100%;border:none;overflow: scroll;"></iframe>

        <script>

            const urlParams = new URLSearchParams(window.location.search);
            const rid = urlParams.get('rid');
            const tabledbid = urlParams.get('tabledbid');
            const myurlroot = urlParams.get('myurlroot');
            const fileattachmentfid = urlParams.get('fileattachmentfid');
            const src = "https://docs.google.com/gview?url=" + myurlroot + "/up/" + tabledbid + "/a/r" + rid + "/e" + fileattachmentfid + "/v0&embedded=true"; 

        document.getElementById("kirk").src = src

        </script>
        </body>
        </html>
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
        Step 2
        Create this field called Attachment type.
         
        var text Suffix = Right([Receipt Photo or Attachment],".");

        var text NonPhotoFileType = 
        Case($Suffix,
        "xls", "File",
        "xlsx", "File",
        "pdf", "File",
        "doc", "File",
        "docx", "File",
        "ppt", "File",
        "pptx", "File");


        If(
        Trim([Receipt Photo or Attachment])="","",
        $NonPhotoFileType<>"", $NonPhotoFileType, "Image")

        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        Create the URL field type for the form. Type = URL . Set as iframe.  Set  800 by 800 size.

        If([Attachment Type 1]="File",

        URLRoot()&"db/"&AppID()&"?a=dbpage&pagename=iframe.html&rid="&[Record ID#]
        &"&tabledbid="&Dbid()
        &"&myurlroot="&URLRoot()
        &"&fileattachmentfid=9")

        // This field refers to iframe.html that is located in the pages section of this app. You will need to copy that code page into your app.
        // You will also have to copy the code from this button and update it for your button to reflect what your file attachment's field id (fid) is.  This this example the file attachment is 432.  Yours may be different.
        // Also be sure to "Allow open access     Allow access to this file attachment from a Quickbase link without signing in".  Edit the file attachment field properties and check the checkbox. Gviewer needs to be able to see the file in order to render it.

        ------------------------------
        Mark Shnier (YQC)
        mark.shnier@gmail.com
        ------------------------------