Goto Previous Page

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

geadon
Ebase User
Posts: 67
Joined: Wed Aug 15, 2012 1:22 pm

Goto Previous Page

#1

Postby geadon » Tue Apr 07, 2020 8:54 am

Why is it when I try to go to the previous page in a sequence of pages on a form that it goes to the last viewed page and not the previous page in the sequence?

I Have a form with the following pages:

Page_1
Page_2
Page_3
Page_4

This works fine to go through the pages from start to finish

Code: Select all

form.gotoPage(form.nextPage);
But if I want to go back to Page_1 from Page_3 I click my 'back' button on Page_3 to go to Page_2 and the same on Page_2 but I end up back on Page_3. I use a component with the following code for the 'back' button.

Code: Select all

form.gotoPage(form.previousPage);
Seems it takes you back to the last displayed page and not the previous in the page sequence.

Is this the intended behaviour? Should I be using a different command to traverse pages?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

Re: Goto Previous Page

#2

Postby Jon » Tue Apr 07, 2020 1:49 pm

It's because the previousPage variable is set dynamically each time you use gotoPage(). So when you return from Page3 to Page2 it sets the previous page to be Page 3 i.e. it interprets gotoPage() as forward movement.

The only way you can effortlessly get the behaviour you want is to use Next/Previous Page Controls instead of your existing buttons with gotoPage() commands - you will find these under the Navigation Buttons section of the pallette. You can either add these buttons individually or you can just add a Page Navigation Panel to the bottom of each page - this adds next/previous buttons as required. These "Page Navigation Buttons" are something of a legacy feature. Note that if you return to a page using a Previous Page Button, the before page script for that page will not run, this is in contrast to gotoPage() which always runs the before page script.

For more info go to the standard documentation in the Verj.io Studio and search for page sequencing.
0 x

geadon
Ebase User
Posts: 67
Joined: Wed Aug 15, 2012 1:22 pm

Re: Goto Previous Page

#3

Postby geadon » Tue Apr 07, 2020 3:26 pm

Thanks Jon for the comprehensive reply. I'll explore the page controls as you suggest to see if they will work for me or not. I tend to put quite a bit of my logic on the before page event, but it may not be needed if returning to a page.
0 x


Who is online

Users browsing this forum: No registered users and 5 guests