Skip to main content
RQ82
Inspiring
October 11, 2020
Answered

Generate a list of items based on "Yes" selections in a PDF form

  • October 11, 2020
  • 2 replies
  • 1930 views

Hey everyone,

I hope I can explain this properly in a way that makes sense. It's a bit confusing so please go easy on me 🙂

 

My client has requested that in a PDF form the user can make a series of "Yes" or "No" answers via radio buttons to numerous questions (see attached).

 

If a user selects "Yes", then on the final page of the PDF, there will be a generated list of additional forms the user must supply. It's simply a reference list. And, if they select "No", or change their answer to "No", then the list would adjust to no longer show the item(s) that would appear if they chose "Yes".

 

The ask was to have a simple list display based on the user selections. I can't figure out how to apply all of these to one field on the last page, and am wondering if I would need to show all of the possible forms they may need to supply in addition to this one, with them all grayed out by default. Based on the "Yes" selections, the fields would highlight/text change color to indicate that the user must also complete these additional forms.

 

I'm wondering if anyone could help me out with this? The client is telling me I can do this easily with Adobe Sign, but I've only used Acrobat and am really struggling with how to pull this off. I know I could do show/hide fields for each one, but I don't want a bunch of empty/hidden spaces all over the last page.

 

Hopefully this isn't completely confusing and makes sense to someone. Would really appreciate any assistance (and be patient - I'm a novice) 🙂

This topic has been closed for replies.
Correct answer try67

1+2) Yes. See below:

 

var items = [];
if (this.getField("Question 1").valueAsString=="Yes") {items.push("Document 1A"); items.push("Document 1B"); items.push("Document 1C");}
if (this.getField("Question2").valueAsString=="Yes") items.push("Document 2");
if (this.getField("Question3").valueAsString=="Yes") items.push("Document 3");
if (this.getField("Question4").valueAsString=="Yes") {items.push("Document 4A"); items.push("Document 4B");}
event.value = items.join("\r");

 

Of course, you need to set the field as being multi-line for it to work...

2 replies

try67
Community Expert
Community Expert
October 11, 2020

You can use something like this as the custom calculation script of the text field that should display the list of selected items:

var items = [];

if (this.getField("Question 1").valueAsString=="Yes") items.push("Document 1");

if (this.getField("Question2").valueAsString=="Yes") items.push("Document 2");

if (this.getField("Question3").valueAsString=="Yes") items.push("Document 3");

if (this.getField("Question4").valueAsString=="Yes") items.push("Document 4");

event.value = items.join(", ");

 

Note that you named "Question 1" with a space before the number, but not the other fields...

RQ82
RQ82Author
Inspiring
October 12, 2020

Thanks @try67  and @Asim123 I'm looking into this now to see if I can make it work.

Inspiring
October 11, 2020

You want List Box or each item can be in text field?