Discussions

 View Only
  • 1.  Include/add pdf flyer on the form

    Posted 05-10-2022 11:26
    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
    ------------------------------


  • 2.  RE: Include/add pdf flyer on the form

    Posted 05-10-2022 11:29
    Do you want to embed the PDF on the form or have a link to it?

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



  • 3.  RE: Include/add pdf flyer on the form

    Posted 05-10-2022 11:36
    Want to embed the pdf..

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



  • 4.  RE: Include/add pdf flyer on the form

    Posted 05-10-2022 12:25
    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
    ------------------------------



  • 5.  RE: Include/add pdf flyer on the form

    Posted 05-10-2022 13:02
    Great! Thank you Mark! 
    Is there any other easy way? I'm also fine to have a link to it washout pdf embed. 

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



  • 6.  RE: Include/add pdf flyer on the form

    Posted 05-10-2022 13:20
    You can make a URL formula field like this on the table with the file.

    URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/e99/v0"

    Where 99 is the file attachment field ID.

    Then don't have any link text enter3d and that will expose the code.

    Copy paste that code to say a dashboard URL field  and the document will open.

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