Mi-Corporation Support

How can we help you today?

How to show/hide pages on iOS/Android

Modified on: Mon, 23 Jun, 2014 at 9:57 AM

When building a Mi-Form template, it is sometimes helpful
to hide pages in the form until certain events have occurred to trigger the
opening of these hidden pages. For example, the choice a user selects from a picklist
could progress the form to a pre-determined page, allowing for a more
personalized experience.

To hide pages on iOS and Android devices, code will need
to be added to the JavaScript editor. There are a variety of different ways to
handle hiding form pages, but the usual location to hide the form pages will be
in the MFAfterOpen() function.

After opening the
editor, click on function
MFAfterOpen() in
the Events window in the top right side of the script editor.

Within
the function, you will need to enter the following command:

_Form.pageHidden(int pageNumber, boolean value)

So to hide page two of the form, the designer would enter:

_Form.pageHidden(2, True)

The screenshot below demonstrates the hiding command:

To have the pages become accessible again, use the same
line of code, but now change the boolean value from value from true to false.
Common places to place the unhide command would be in hotspots, picklist choices,
or after certain data fields have been filled.

Another way to accomplish locking a certain number of
pages would be with a simple for loop, as shown below:

Hiding pages can also be done in VB.Net for Windows based
Mi-Forms. The biggest difference to remember when hiding pages in VB.Net is
that the index for the pages starts at 0 and not at 1.

To start, open the
.Net script editor and select the AfterOpen method from the Events window:

Here, use the following expression to hide the desired
pages, filling pageNumber with the desired page and value with the desired
Boolean status:

_Form.Pages(int pageNumber).Hidden = Boolean value

Don’t forget that .Net indexing starts at 0! An example
is below:

To unhide the form, simple change the Boolean value from
true to false: