Web Flow With Random Navigation
This example is like the Web Flows And Wizards example, with buttons added to allow the user to navigate randomly
throghout the Credit Application. The user can partially fill in a page, then switch to another page without losing
any entered data.
There are some rules to follow to enable this kind of flow:
- Don't disable validation on click of the random navigation buttons. Otherwise anomalies
will occur when nonsense data is entered, eg. when ABC is entered in a number field or date field
the previous value will be remembered whereas the other fields will have their new value remembered.
- Drop "required" from validators. Otherwise the user will be forced to complete a page before
switching to another page.
- Finish with full validation. The finishing page must ensure all the required data has been
entered and all the business rules satisfied. In this example you will see that the doNext() method of
WebFlow2FinishPage calls creditApplication.validate().
The buttons on the left are the first <input> fields, which causes a few look and feel problems. This example
includes techniques to solve them:
- Focus is not on the Amount field. Tapestry gets confused and tries to set focus on the Start
button. We solve this by overriding the getFocusField() method of the ValidationDelegate. We do this in each page.
- "Next" is not the default button for Enter. The browsers treat either the first button as default
or no button as the default.
We solve this by inserting a Script component called SetDefaultButton in the layout component, WebFlow2Layout.
- IE emboldens the first button. We solve this with a dummy submit button, one that's not visible,
before the first real button.