Paginating InfoPath forms with views

Forms with a lot of input fields and information can be cumbersome to the user if everything is displayed all at once. With InfoPath, we can organize content into separate views. In this recipe, we will create a form with two views and buttons to toggle between.

How to do it...

Follow these steps to create pages in a form using views:

  1. Create a new form template or open an existing one in Microsoft InfoPath Designer 2013.
  2. Select New View from the PAGE DESIGN tab in the ribbon as shown in the following screenshot:
    How to do it...
  3. Provide the view (or page) with a name and select OK. To toggle between views when designing a form template, select the view from the drop-down list on the PAGE DESIGN tab in the ribbon:
    How to do it...
  4. Add a Button control to each view.
  5. Select the Button control in the first view.
  6. Navigate to CONTROL TOOLS | PROPERTIES and provide the Button control with an appropriate label, such as Next.
  7. Navigate to CONTROL TOOLS | PROPERTIES and select Rules in the Button section as shown in the following screenshot:
    How to do it...
  8. In the Rules pane (on the right-hand side of the window), select Action from the New menu.
  9. Provide the Action with a name, such as Switch to View 2.
  10. Under Run these actions, select Switch views from the Add menu as shown in the following screenshot:
    How to do it...
  11. Select the second view and click on OK.
  12. Select the Button control created on the second view.
  13. Provide an appropriate label for it, such as Previous.
  14. Repeat steps 7 to 11 to provide an Action Rule to change the view back to the first view.
  15. Using the Preview button, preview the form template to observe the results of clicking on each button.

How it works...

A view in InfoPath acts like a page with its own layout and field references. Each view may have a unique layout independent of other views. In this recipe, we added a secondary view in addition to a button on each view. We then used actions triggered by button clicks to switch between our views. Actions allow us to perform various operations in the form, such as switching views or manipulating data.

InfoPath views can be used for a variety of purposes beyond paging. Examples include using a read-only view to display the data entered after a form has been submitted, using views to display the form in different languages, and hiding or showing areas of the form based on the previous input.

See also

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.172.93