Checkboxes not working on a spawned page

Community Beginner ,
Apr 26, 2022 Apr 26, 2022

Copy link to clipboard

Copied

Here is my code for the spawned page

var SpawnPage = this.getTemplate({cName: "table"});
  SpawnPage.spawn({nPage: this.numPages, bRename: true, bOverlay: false});
    this.getField("P" + (this.numPages - 1) + ".table.Name").setFocus();

The code for the checkbox looks like this:

var nDisplay = event.target.isBoxChecked(0) ? display.visible : display.hidden;
this.getField("P" + (this.numPages - 1) + ".table.Dropdown39").display = nDisplay;
this.getField("P" + (this.numPages - 1) + ".table.Text40").display = nDisplay;
this.getField("P" + (this.numPages - 1) + ".table.Text41").display = nDisplay;

Unfortunatelly it doesn't work. I have no idea how I should link the checkbox to the correct element on the spawned page...

TOPICS
PDF forms

Views

199

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 , Apr 27, 2022 Apr 27, 2022

Then use event.target.page instead of this.numPages-1. For example:

 

this.getField("P" + (event.target.page) + ".table.Text41").display = nDisplay;

Likes

Translate

Translate
Adobe Community Professional ,
Apr 26, 2022 Apr 26, 2022

Copy link to clipboard

Copied

Check the Javascript console for errors.

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
Community Beginner ,
Apr 26, 2022 Apr 26, 2022

Copy link to clipboard

Copied

I thought that maybe it has to do something with this line: 

this.getField("P" + (this.numPages - 1) + ".table.Text41").display = nDisplay;

I guess that it points everytime on the element that is spawned. In that case if I have this element at the top of every spawned page and it is named P4.table.Text41, P5.table.Text41, P6.table.Text41, etc. if I check one checkbox, that top element on every spawned page is checked. How to avoid this?

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
Adobe Community Professional ,
Apr 26, 2022 Apr 26, 2022

Copy link to clipboard

Copied

Is the purpose of the check-box to show/hide fields on the same page as it is, or on another page?

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
Community Beginner ,
Apr 26, 2022 Apr 26, 2022

Copy link to clipboard

Copied

On the same page.

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
Adobe Community Professional ,
Apr 27, 2022 Apr 27, 2022

Copy link to clipboard

Copied

Then use event.target.page instead of this.numPages-1. For example:

 

this.getField("P" + (event.target.page) + ".table.Text41").display = nDisplay;

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
Community Beginner ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

Hey, I have missed your response somehow. It works just fine. Thank you!

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
Adobe Community Professional ,
Apr 27, 2022 Apr 27, 2022

Copy link to clipboard

Copied

Can you share the form?

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
Community Beginner ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

Plese find a form attached. I have deleted all not needed information and left only the objects that are causing the problem.

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
Community Beginner ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

PS. ON/OFF button is for the purpose when checkbox won't be working. In that case I would have to leave the buttons then, but I would really like to have the checkboxes working instead of those buttons.

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
Adobe Community Professional ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

You didn't apply the changes I specified.

Also, you should hide the Template page and manually spawn one copy from it, so that it works there, too.

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
Community Beginner ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

You are right ; ) I have missed your response. Everything works now. Thank you for your 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
community guidelines
Community Beginner ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

I have noticed strange behavior. The checkbox works but only after third spawned page. At first two spawned pages it doesnt work but third page is already functional and every page after third also works. I have the latest version of Adobe Reader...

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
Adobe Community Professional ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

Did you do as I advised?

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
Community Beginner ,
Apr 28, 2022 Apr 28, 2022

Copy link to clipboard

Copied

LATEST

 I had to use for this form Foxit and it has some bugs and when I save the form with hidden templates they dissapear. I am waiting for an update to solve this issue. Anyway, in the Adobe Reader the problem is like I said. After third spawned page the checkboxes works.

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