Expand my Community achievements bar.

Automatically move to top of next page

Avatar

Level 1

In my attached form I collect info and then at the bottom I have a button to add the next disclosure, this creates a new subform on the next page.  I would like (if possible) to be able to automatically move to the top of the next page when the "Next Disclosure"  button is clicked.  Is this possible?

Thanks for the help.

11 Replies

Avatar

Level 4

Select the page1 form and on the properties -> pagination -> place select "on top of page 1"

Avatar

Level 1

That did not work.  The next page is added but I still have to scroll to see it.  Is there a way to have the next page automatically scrolled into position without the user having to scroll down to see it?

Avatar

Level 4

Yes, you can use the setFocus (on the new instance) method after you add the new instance to the form.

Avatar

Level 1

Can you give me an example of using setFocus?  I tried xfa.host.setFocus("CompanyName") and that puts the focus on the first page not the next page.  When I changed it to ..("CompanyName[1]") that didn't work.

Thanks again for the help.

Avatar

Level 3

This has worked for me:

// jump to next page

xfa.host.pageDown();

//optional - alert the user

app.alert("You have jumped to the newly added Treatment page")

Avatar

Level 4

I use a similar command and it work.

xfa.host.setFocus(xfa.resolveNode("CompanyName["+(CompanyName.instanceManager.count-1)+"].CHOOSE_A_FIELD_TO_SET_FOCUS"));

I haven't tested this on your form, but it should work. Just one not, your javascript must run on client.

Avatar

Former Community Member

The setFocus command is the command to use but your objects do not exist until the script is finished. The only way I have found to do this is by using an Acroform command to execute another command in the future.

Here is the command:

Paul

Avatar

Level 4

Paul,

If you put the setFocus command on the Initialize event of the object (the one thats added) woun't it only be invoked after the creation of the object is finished?

Avatar

Level 1

Thank you guys for the wonderful tips but I'm just not getting it to work.  Can you post an example that works so that I can see what I'm supposed to do?

Jay

Avatar

Level 1

Rui,

That worked, thank you so much!  Thanks to Paul and malaki as well.  I'm posting the form if anyone else wants to see the code, it's under the "Next Disclosure" button.

Thanks again!

Jay