Skip to main content
subvet720
Participant
Dec 11, 2018 1:51 PM UTC
Answered

Using an Action, how do I repeat a text field that I created on the top of the first page?

I created an Action that creates a text field on the top of the page. How do I get it to repeat it on the top of the remainder of the pages in the document?

// Create the "DatePrinted" field on the top of the first page

var fldTop = this.addField("DatePrinted", "text", 0, [36,774,576,756]);

fldTop.value = "DatePrinted";

fldTop.textSize = 14;

fldTop.textfont = font.Arial;

fldTop.textColor = color.red;

fldTop.alignment = "center";

fldTop.display = display.hidden;

fldTop.readonly= true;

fldTop.doNotSpellCheck = true;

fldTop.doNotScroll = true;

Any assistance will be greatly appreciated,

Thanks

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Dec 11, 2018 2:03 PM UTC

You need to place your code inside a loop from 0 to this.numPages, changing the third parameter of the addField method to the page number in each iteration.

5 replies

subvet720
subvet720Author
Participant
Dec 12, 2018 11:32 AM UTC

My solution for any interested parties... Not elegant, but it works

for (var pg = 0; pg < this.numPages; pg++) {

// Place text field on the top of the page

var f = this.addField("DatePrinted", "text", pg, [36,774,576,756]);

/}

Translate
try67
Community Expert
Community Expert
Dec 12, 2018 12:19 PM UTC

Why do you say it's "not elegant"?

Translate
subvet720
subvet720Author
Participant
Dec 11, 2018 2:11 PM UTC

That's what I originally thought, but was thinking there had to be a magic way to get er' done. It will work, and Thanks!

Translate
try67
Community Expert
Community Expert
Dec 11, 2018 2:14 PM UTC

No "magical" way to do it, no...

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Dec 11, 2018 2:03 PM UTC

You need to place your code inside a loop from 0 to this.numPages, changing the third parameter of the addField method to the page number in each iteration.

Translate