Expand my Community achievements bar.

SOLVED

Clicking Add Page button deletes data from initial page.

Avatar

Level 2

I have an Add Page button on the first page. I enter information into my first page. When I click the Add Page button, a new page (page 2) is added but the information I have inputted into the first page disappears. I have attached the form that I am struggling with. Any help would be appreciated!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Modified your sampel to make it work.

1. For the Page 2 subform you should set the minsize as 0,  themaxsize to 1 and the initial count to 0. In doing this there is no addressable object to script against.

2. In the code that adds the page you have a command:

form1.Page2.instancemanager.addInstance()

As there are no subforms for Page2 present you get an error about the object not existing. The Page2 object does not exist yet so you cannot call teh instanceManager method. So you must use another notation to get to the instanceManager. In this instance you vcan use the underscore (_) notation to access the instanceManager of an object that is not part of the layout yet. So your command will be:

form1._Page2.addInstance().

3. You may want to disable the button after they add the second page as well as position the cursor in teh 1st field on teh next page. To do this you can add this code:

xfa.host.setFocus(Page2.Table1.Row2.Action_Step);
this.presence = "invisible";

Note that you must reposition the cursor before you hide the object otherwise the hide the button code will not work.

Hope that helps

Paul

View solution in original post

4 Replies

Avatar

Former Community Member

You have placed all of your content on the Master Pages. These Master Pages are intended for repeating content that appears on each page (i.e. Headers, footers, watermarks, etc ...). Take all of that content and move it to the actual pages. If you look at the hierarchy view then you can minimize the Master Page view and you will see the Page where you shodul place your content. Once you do this it will work as you want.

I took a run at it but I do not know what is content and what should be repeating content.

Paul

Avatar

Level 2

I moved all relevant data to two regular pages (Page1 and Page2). I am now getting another error.

I want the initial view to be just the first page and to only add the second when the Add Page button is clicked.

Page 2: I set the Min Count to <blank> and Max Count to 1 so that it doesn't initially display. When I click the Add Page button, the error says, 'form1.Page2.instanceManager.addinstance()' is unknown.

I know I am missing something basic and appreciate your assistance.

Thanks!

Avatar

Correct answer by
Former Community Member

Modified your sampel to make it work.

1. For the Page 2 subform you should set the minsize as 0,  themaxsize to 1 and the initial count to 0. In doing this there is no addressable object to script against.

2. In the code that adds the page you have a command:

form1.Page2.instancemanager.addInstance()

As there are no subforms for Page2 present you get an error about the object not existing. The Page2 object does not exist yet so you cannot call teh instanceManager method. So you must use another notation to get to the instanceManager. In this instance you vcan use the underscore (_) notation to access the instanceManager of an object that is not part of the layout yet. So your command will be:

form1._Page2.addInstance().

3. You may want to disable the button after they add the second page as well as position the cursor in teh 1st field on teh next page. To do this you can add this code:

xfa.host.setFocus(Page2.Table1.Row2.Action_Step);
this.presence = "invisible";

Note that you must reposition the cursor before you hide the object otherwise the hide the button code will not work.

Hope that helps

Paul

Avatar

Level 2

Thank you for this excellent help!!

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----