I was recently asked to implement a fairly large and complicated form in APEX. Rather than displaying something long and scary to users on a single page, we decided to break it out into sections on different pages, and use a Sidebar Navigation Region that would show the user which section he/she was currently filling out, and where in the process he/she was, as in the example below. By the way, this also happened to be the same form in which I implemented a simple yet powerful workflow using Dynamic PL/SQL.
We decided to use the Progress Wizard List Template, and with that, we were pretty much 80% of the way there. Gotta love APEX! We just needed to make a few small tweaks.
1.We wanted the user to be able to navigate to a specific section of the form by clicking on the relevant sidebar link on the left. This meant branching to a different page.
2. We also wanted to trigger an automatic save (SUBMIT) of the form when he/she clicked on the relevant sidebar entry, without having to click on the ‘Save’ button.
1. Created a Page 0
2. Added the following (hidden) item to Page 0: P0_BRANCH_PAGE
3. Added an After Submit branch to each of the pages involved in the workflow, branching to page P0_BRANCH_PAGE (using the &P0_BRANCH_PAGE. syntax).
4. Created my list using the Wizard Progress template.
5. I used the User Attributes section of each list entry to track the branch page. This way, I could refer to it in my template using #A01# substitution. Here’s an example of my ‘Step 1’ list entry, which I want to branch to page 1:
6. I modified the template of my Progress Wizard from the following:
The apex.submit line performs 2 actions at once: sets the value of REQUEST to ‘SAVE’, but also sets the value of the P0_BRANCH_PAGE item. You can set any number of items using this method, but careful, I have found that it does not appear to work if the item is on the current page (not sure why…).
Voilà, as easy as that! Users are now able to navigate to any section of the form by clicking on the wizard, and their changes get saved automatically. Was this the best way to go about it? Not sure, but it works great. If you have any comments or suggestions on how else I could have accomplished this, I’d love to hear them!