4 Replies Latest reply on Jan 14, 2010 11:17 AM by ace1620

    Clicking Add Page button deletes data from initial page.

    ace1620

      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. Re: Clicking Add Page button deletes data from initial page.
          pguerett Level 6

          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

          • 2. Re: Clicking Add Page button deletes data from initial page.
            ace1620 Level 1

            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!

            • 3. Re: Clicking Add Page button deletes data from initial page.
              pguerett Level 6

              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

              • 4. Re: Clicking Add Page button deletes data from initial page.
                ace1620 Level 1

                Thank you for this excellent help!!