Forum Discussion
ArchiveUser
9 years agoQrew Captain
I was able to accomplish this with the Image Onload Technique:
https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=320&rl=psr
Create a Formula - Text Field named Attachment Viewer (separate from the Image Onload field) in the desired table. Be sure to check the box allowing HTML and insert the following:
var text URL =
"https://docs.google.com/gview?url="; &
URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/eFID/v0&embedded=True";
"<embed src=\"" & $URL & "\" height=\"650\" width=\"900\">"
Replace FID with the field # of your attachment field.
In the module.js page under the desired headings (Edit Record/Display Record) paste the following:
$("#tdf_22").html($("#tdf_22").text().replace(/{{/g,"<").replace(/}}/g,">"));
Where I have 22 you'll need to adjust this # to be the placement of the Attachment Viewer in your form. Start with testing the # to the left of the field in the form builder and decrease from there if necessary.
Ex: In my case it's the 23rd object on the form, and I need to use 22 in the script page.
I've attached a picture of the final result.

https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=320&rl=psr
Create a Formula - Text Field named Attachment Viewer (separate from the Image Onload field) in the desired table. Be sure to check the box allowing HTML and insert the following:
var text URL =
"https://docs.google.com/gview?url="; &
URLRoot() & "up/" & Dbid() & "/a/r" & [Record ID#] & "/eFID/v0&embedded=True";
"<embed src=\"" & $URL & "\" height=\"650\" width=\"900\">"
Replace FID with the field # of your attachment field.
In the module.js page under the desired headings (Edit Record/Display Record) paste the following:
$("#tdf_22").html($("#tdf_22").text().replace(/{{/g,"<").replace(/}}/g,">"));
Where I have 22 you'll need to adjust this # to be the placement of the Attachment Viewer in your form. Start with testing the # to the left of the field in the form builder and decrease from there if necessary.
Ex: In my case it's the 23rd object on the form, and I need to use 22 in the script page.
I've attached a picture of the final result.