Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How do I add an "add new page" button?

Avatar

Level 1

Hello,

I have searched the forum about this, and the only answer I saw was where someone took a form and modified it for that person, but did not include the code they used or how to use it, where to insert it, etc.

I have the attached dynamic form I created, and all I want is a button on the bottom where a user can click, and then be presented with a new clean version of the form, as a second page, and every time they click, another blank page is added to the document.

Any help will be greatly appreciated, as I need to start using this form asap, and this is the only thing holding me up.

Thanks!

-Paul

6 Replies

Avatar

Level 10

Hi,

Here is a sample. First of all name "page1" and have a look at the pagination options in Object / Pagination panel.

Button with script:

page1.instanceManager.addInstance(); 

should work.

Lastly, in the properties the form was set to print preview as opposed to interactive preview.

Good luck,

Niall

Avatar

Level 1

Hi  Same problem...and very tired brain..  Niall, is it possible for you to help me out?

I can´t get the button to work..probably IBK... (idiot behind the keyboard)

Very thankful for all help I can get.

http://dl.dropbox.com/u/7416663/Dagbok%20v3.pdf

Avatar

Level 10

Hi,

You were nearly there. The script was okay, however the file was saved as a Static Form, whereas for this sort of dynamic behaviour you must save the form as a Dynamic XML Form in the save as dialog.

Also you need to specify that page1 can be repeated. Select the page in the hierarchy and in the Object > Binding palette tick Repeat  subform:

Parallels Desktop1.png

Here is your form back to you: https://acrobat.com/#d=xeO3y9S5QCw4YhWnel-L3w

I didn't have your font, so you may just want to make the changes in your version.

Hope that helps,

Niall

Assure Dynamics

Avatar

Level 1

Hi again..

Is it possible to get a field och text to change color (or context) depending on another field?

For example, if a text is entered in one field another field would change to red with the text "YES" in....and if a different field has text entered it would change to green and "NO"

/Jonas

Avatar

Level 10

Hi Jonas,

Yes, this is possible. The script to change the colour of the textfield value is:

TextField1.font.fill.color.value = "R,G,B";

You can also change the colour of the caption:

TextField1.caption.font.fill.color.value = "R,G,B";

You would just need to wrap this in an if statement looking at the values of the other fields.

For example the following in the calculate event of the yes/no textfield:

if (textfield1.rawValue != null)

{

     this.font.fill.color.value = "120,255,120";

     this.rawValue = "Yes";

}

else if (textfield2.rawValue != null)

{

     this.font.fill.color.value = "255,120,120";

     this.rawValue = "No";

}

else

{

     this.font.fill.color.value = "0,0,0";

     this.rawValue = "";

}

Hope that helps,

Niall

Assure Dynamics