Copy link to clipboard
Copied
Hello Everyone,
I need to implement a decision tree in a pdf. We need to ask a series of questions where the next question is dependent on the current answer and there are ten different question paths. At the end of a question path I’d like to send an email containing the user’s answers.
Rather than using a pdf form to ask the questions, I’d like to present the question on a page with the answers displayed as images that when clicked takes the user to the next question. I was hoping to somehow capture each image clicked (i.e., the answer to each question) then email them to myself.
I am trying to determine how to best build this solution this using Acrobat Pro. People would be answering the questions using Acrobat Reader.
Could I call a javascript function when an image is clicked that saves a value (i.e., the answer) to an array then at the end send the contents of the array as an email?
Or, perhaps I could use a hidden form whose field values are set when the user clicks on an image (i.e., the answer) and then email the .fdf file at the end?
Can anyone tell me if either of these solutions is possible in Acrobat Pro or recommend a different solution using Acrobat Pro?
Thank you.
robertg
Without knowing your specific strategy I couldn't suggest anything specific, but in general you'll need info on scripting the field required interactions. Look at the sample file I linked above, and then there are these articles.
https://www.pdfscripting.com/public/PDF-Page-Coordinates.cfm
https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm
I'd also be happy to provide custom consulting/training for the specific things you'll need for the form.
Contact me through this forum or www.pdfscripting.com
...Copy link to clipboard
Copied
Yes, this is perfectly doable in a PDF. For example, an image can be displayed on a button field, you can use the button as a way to capture the answer. Another advantage to using a button for this is that a button has a border. This border can act as a highlight to show a selection, and buttons can be hidden and shown. There is a lot of flexibility with Acrobat form fields.
At the end of the process a script could send an email with the compiled data in the body text. Or it could copy the answers to hidden fields that are then used to build an FDF file that is emailed. Lots of possibilities.
Copy link to clipboard
Copied
As mentioned, this is doable in Acrobat, yes. I would recommend using a hidden text field (or multiple fields) to collect the answers based on the buttons clicked, and then use a script to examine those fields to determine where to email the file.
Copy link to clipboard
Copied
Thank you both for your time, confirmation that I can implement the functionality I need using Acrobat and suggestions.on possible methods.
Our primary reason for wanting to use a PDF instead of an HTML form is the look and feel. So, the plan is to have a designer create the pages that include the question and the answer images in InDesign then export it as a pdf and then I'd add the functionality to the pdf.
Do the answer images that would be displayed on a button field need to be separate images (so not part of the page background)? I'm trying to determine how to display the 'answer image/button field' and control its position on the page.
Thanks again.
robertg
Copy link to clipboard
Copied
First, if the images are displayed on buttons, then they cannot be part of the background, since they will be added later with the buttons.
You'll find a sample file here that uses images on interactive buttons, it's the Swat the Fly game.
https://www.pdfscripting.com/public/Free-Sample-PDF-Files-with-scripts.cfm
The functionality you have described required a great deal of scripting. So I'd suggest learning about the Acrobat Scripting model. You'll find the answers you need here:
Copy link to clipboard
Copied
Thanks again for the reply @Thom Parker
My background is a front end developer so I have lots of experience with HTML, CSS, and Javascript but have no real PDF development experience.
Do you know if there are any scripts available with pdfscripting.com membership that might give me a good start on building the functionality I need to implement?
Thanks.
Copy link to clipboard
Copied
Without knowing your specific strategy I couldn't suggest anything specific, but in general you'll need info on scripting the field required interactions. Look at the sample file I linked above, and then there are these articles.
https://www.pdfscripting.com/public/PDF-Page-Coordinates.cfm
https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm
I'd also be happy to provide custom consulting/training for the specific things you'll need for the form.
Contact me through this forum or www.pdfscripting.com.
Copy link to clipboard
Copied
Thank you for your time and help Thom.