Step 7. Control which Tab is redisplayed

WAM060 - Employee Maintenance using Advanced Weblets

At present the Details WebRoutine has no control over whether the Details or Skills tab is redisplayed. This can easily be achieved by introducing a field that is mapped to set the tab_index property.

1.  Define a one character field TABINDEX.

Define Field(#tabindex) Type(*char) Length(1)

2.  In the Details WebRoutine extend the web_map for EMPNO to include TABINDEX as a hidden field.

Web_Map For(*both) Fields((#empno *hidden) (#tabindex *hidden))

3.  In the CASE loop, set the TABINDEX in each When clause, as follows:

When = D

#Tabindex := '1'

When = U

#Tabindex := '1'

When = N

#Tabindex := '2'

When = S

#Tabindex := '2'

4.  Recompile your WAM.

5.  Open the Details WebRoutine in the Design view.  Select the Tab Pages weblet and set the selected_tab_index_field to TABINDEX. (Select from the dropdown).

6.  Ensure the Details tab page is selected and Save your changes

7.  Re-test your WAM. When working with the Skills tab, the Skills tab should now be redisplayed after the New Skill or the Save push button has been used.

Note: This is a limited implementation, using simply the tab_index_field property. Using a hidden Nav Panel on each tab page, it is possible to return current tab index to a WebRoutine. This allows a design which supports selecting a different employee and always displaying the last tab page used (Details or Skills).