Highlighted

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

Community Beginner ,
Oct 11, 2020

Copy link to clipboard

Copied

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) 🙂

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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...

TOPICS
PDF forms

Views

58

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

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

Community Beginner ,
Oct 11, 2020

Copy link to clipboard

Copied

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) 🙂

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

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...

TOPICS
PDF forms

Views

59

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 11, 2020 0
Contributor ,
Oct 11, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 11, 2020 0
Most Valuable Participant ,
Oct 11, 2020

Copy link to clipboard

Copied

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...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 11, 2020 1
Community Beginner ,
Oct 11, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 11, 2020 0
Community Beginner ,
Oct 11, 2020

Copy link to clipboard

Copied

Thanks @try67 this does essentially what I was hoping! I have two more questions:

 

1.) Can each entry on the last page be on individual lines, as opposed to spaced by a comma and continuing on the same line

 

2.) Is there a way I could have multiple items for some of the "Yes" selections as seen here:

 

Document 1A

Document 1B

Document 1C

Document 2

Document 3

Document 4A

Document 4B

 

Thank you so much to both of you for responding. I really appreciate the help!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 11, 2020 0
Most Valuable Participant ,
Oct 12, 2020

Copy link to clipboard

Copied

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...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 12, 2020 1
Community Beginner ,
Oct 12, 2020

Copy link to clipboard

Copied

Thank you so much!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 12, 2020 0