Expand my Community achievements bar.

Copying a page with data

Avatar

Level 2

I've got a form I put together that I use for tracking equipment. I have set it up with a button that will copy the page, but it just copies the page but not the data already entered into the form. The thing is, most of the time I am I end up filling out the same data for nearly all the fields except for one or two. It would be nice to be able to click the add page button at the bottom and have it copy the page with the data that's already been entered... or have a separate button entirely. One for copying the page (without any data already entered) and the other for copying the page with the data already entered. Any help would be APPRECIATED!

Thanks.

3 Replies

Avatar

Level 2

Well shoot. I feel better knowing my question is harder to answer than I thought.

It may not even be possible but at least then I could finalize this form.

Thanks again for any help.

Avatar

Level 10

You probably have to write the code to populate each field in the new page with the previous page's data.

For example:

     Form1.Page1.Subform1[1].TextField1.rawValue = Form1.Page1.Subform1[0].TextField1.rawValue;

     where subform1 is repeating multiple times at run time..

You can place the code in the button click event where you are adding the new instance.

I have hard coded the index value as [1], but in your scenario, you need to replace with the latest index of Subform that was added.

     You can get the latest index by using

               int latestIndex = Form1.Page1.Subform1.instanceManager.count -1;

               Form1.Page1.resolveNode("Subform1[" + latestIndex + "]").TextField1.rawValue = Form1.Page1.Subform1[0].TextField1.rawValue;

Hope this helps..

Thanks

Srini

Avatar

Level 2

Thanks for your post Srini - unfortunately I haven't been able to get this to work.

I was hoping I could take advantage of the Action Builder in ES2 but I don't see any way to create an action that would copy data from the existing page to the new page since it technically doesn't exist until the new instance is created when the button is executed.