Dynamic Field to display Link, or Default Image or Embed PDF... for a PDF Uploaded in another form.

By: Chris Stewart | Asked: 05/11/2022
ForumsCategory: General questionsDynamic Field to display Link, or Default Image or Embed PDF... for a PDF Uploaded in another form.
Chris StewartChris Stewart asked 2 years ago
Here is the use case: Form ONE uploads a PDF file. A VIEW lists the Form ONE contents, including a LINK to the uploaded file - excellent, this presents a file-named text link that opens in a new tab in the browser. A buttton/link in the VIEW enables Form TWO to display some content from Form ONE using Dynamic Fields... an image, some text, etc. But when trying to pass the PDF uploaded in Form ONE to display in Form TWO via a Dynamic Field there are issues. It works for Form TWO Dynamic Field to fetch and display the LINK to the PDF file, but it filters it as an image and attempts to GET an image thumbnail that does not exist. Ideally it would:
1) enable display of a LINK in the same shortcode format options as per a View (eg [115 add_link=1 show_filename=1 new_tab=1] added to a Dynamic Field's "Default Value").
2) enable defining a Default Image for the PDF (or other LINKED uploaded file type) that performs like the LINK in option #1.
3) *most ideally* enable embedding of a PDF (eg using embed display via shortcode using "Mozilla’s PDF.js" exampled by https://en-au.wordpress.org/plugins/wonderplugin-pdf-embed/ )   Formidable Forms is uninterested in this Support case and feature development. 

If you're confident you'd know a way to achieve any of the above outcomes (Link, Image, Embedded PDF) via a Functions.php code snippet or a custom plugin please contact me! 
Bobby Clapp replied 2 years ago

Is something required in terms of user interaction to get the link to the PDF or is that coming dynamically from some sort of cascading effect from other dynamic fields? I ask, because you might be able to make that field hidden, drop in and HTML field and then use the PDF dynamic field id inside the HTML field and do whatever you want with it.

Chris StewartChris Stewart replied 2 years ago

Ahh! Thank you Bobby. The PDF Link is a field value from an UPLOAD Field in one form... that is being called via a Dynamic Field in a second form.

Loading it into the second form via a Dynamic Field and then using a HTML field to pull that value isn't something I had thought of or tried. So thank you! It led me to being able to see the link cleanly... but not put it active around an image or use in a pdf embed shortcode... even with daisy chained html fields... BUT it prompted me to carefully review these instructions... https://formidableforms.com/knowledgebase/get-a-value-from-an-entry/ and I found a way to go to the Form One upload field directly and filter for the specific entry and strip the html....

Using this approach I DID manage to get a link with an image to show cleanly. Had to use the Form One field ID with the View refferring paramater name ("offer" in this case) to get the specific entry and set html=0 to stop Formidable trying to render the PDF as an image... so that I could wrap the PDF's direct link around a default image. Ended up with a shortcode like this: [frm-field-value field_id=115 entry=offer html=0] as the LINK in a linked image.

Haven't been able to get the PDF embed shortcode to work though, sadly... so my work continues.

THANK YOU for the prompt that led me down this path to a solution!

Chris StewartChris Stewart replied 2 years ago

Update: After Formdiable Forms tech support confirmed it wouldn't be possible, I ended up paying someone to create a custom code snippet that would work to embed the PDF.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community