Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Help spawning page templates based on multiple criteria

Explorer ,
May 02, 2021 May 02, 2021

Copy link to clipboard

Copied

I need help spawing pages that are dependent on two different factors: 

1)  A drop down selections export value, and

2) A text fields user-entered value (the value is entered after the drop down selection is made). 

 

Here's how the spawned template(s) will be determined:

dd selection with Export Value of "A" = "Template A" + "Template B" (2 pp.)

dd selection with Export Value of "C" = "Template C" (1p.)

dd selection with Export Value of "A" + text field value " ≤20" = "Template C"

 

I know how to have the correct page(s) spawn based on the drop down selection alone (using custom keystroke script), but I don't know how to add the text field value as a variable. I was thinking of adding a button after all information on the page is entered, but I don't know what the script would be to factor in the variables. Currently I only know how to add a Mouse Up Action that will spawn a specified template (i.e.: this.getTemplate("Template Name").spawn(this.numPages, false, false) ; ), but not how to have the spawned template based on other field values. 

 

Is there a way to write a Mouse Up Action script for a button with conditional if statements and field names?  Any help would be appreciated. 

 

FYI: There are also other areas of this form page that spawn pages. Currently, if a user changes/toggles their selection, multiple/extra pages are spawned. If all the pages could be spawned from one button at the bottom page after all their choices are made, this could possibly elimate that issue. 

TOPICS
How to, JavaScript, PDF forms

Views

100

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
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , May 02, 2021 May 02, 2021
Of course there is. The general structure for such a code would be: var v1 = this.getField("Text1").valueAsString; var v2 = this.getField("Dropdown2").valueAsString; if (v1=="A" && v2=="B") { this.getTemplate("Template Name1").spawn(this.numPages, false, false) ; } else if (v1=="A" && v2=="C") { this.getTemplate("Template Name2").spawn(this.numPages, false, false) ; } else if (v1=="B" && v2=="C") { this.getTemplate("Template Name3").spawn(this.numPages, false, false) ; } etc.

Likes

Translate

Translate
Adobe Community Professional ,
May 02, 2021 May 02, 2021

Copy link to clipboard

Copied

Of course there is. The general structure for such a code would be:

var v1 = this.getField("Text1").valueAsString;
var v2 = this.getField("Dropdown2").valueAsString;

if (v1=="A" && v2=="B") {
	this.getTemplate("Template Name1").spawn(this.numPages, false, false) ;
} else if (v1=="A" && v2=="C") {
	this.getTemplate("Template Name2").spawn(this.numPages, false, false) ;
} else if (v1=="B" && v2=="C") {
	this.getTemplate("Template Name3").spawn(this.numPages, false, false) ;
}

 

etc.

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
community guidelines
Explorer ,
May 02, 2021 May 02, 2021

Copy link to clipboard

Copied

LATEST

That was very helpful. 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
community guidelines