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...
Then use event.target.page instead of this.numPages-1. For example:
this.getField("P" + (event.target.page) + ".table.Text41").display = nDisplay;
Copy link to clipboard
Copied
Check the Javascript console for errors.
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?
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?
Copy link to clipboard
Copied
On the same page.
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;
Copy link to clipboard
Copied
Hey, I have missed your response somehow. It works just fine. Thank you!
Copy link to clipboard
Copied
Can you share the form?
Copy link to clipboard
Copied
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.
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.
Copy link to clipboard
Copied
You are right ; ) I have missed your response. Everything works now. Thank you for your help.
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...
Copy link to clipboard
Copied
Did you do as I advised?
Copy link to clipboard
Copied
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.