Date tip published: | 02/27/2006 |
Description: | A little known setting in a View's properties box will allow actions to be hidden or shown depending on which documents are highlighted in the view. This allows the action to be hidden if it is not appropriate for that document. For example, an action to mark a document as "active" could be hidden if the document is already "active." |
To learn more about Notes Domino Application Development use the following links:
Notes Domino 6 Application Development 1
Notes Domino 6 Application Development 2
Notes Domino 7 Application Development 1
Dynamically Hiding View Actions
This tip describes how to set a view property to allow an action to be hidden or shown depending on which document is highlighted in the view. This allows the action to be hidden if it is not appropriate for that document. For example, an action to mark a document as "active" could be hidden if the document is already "active."
Normally the view actions that appear in a view's action bar are always displayed. The image below shows a view with two actions. One action changes the customer's status to "Active" and the other action changes the status to "Inactive". Since the selected document in this view is an "Active" customer, the [Change to Active] view action should be hidden.
Use the following hide-when formula for the [Change to Active] view action. In this example, "4" is the synonym for "Active" for the status keyword field. The reason for testing the form field is to also hide this action when a category is selected in the view.
!( status != "4" & form="CustomerForm") |
Use the following hide-when formula for the [Change to Inactive] view action. In this example, "5" is the synonym for "Inactive" for the status keyword field. The reason for testing the form field is to also hide this action when a category is selected in the view.
!( status != "5" & form="CustomerForm") |
There is one more step after applying the above hide-when formulas. Set the view property to "Evaluate actions for every document change". If this step is not done then the two actions will never appear since they depend on values in the highlighted document in the view. Set this property on the Information tab of the View's properties, as shown in the following image.
After adding the hide-when formulas to the two actions and setting the "Evaluate actions for every document change" view property, the appropriate action will be hidden as the user moves through the view. In the following image, the status of the selected document is "Active" so the [Change to Active] view action is hidden.
As the following image shows, both actions are hidden when a category is selected in the view.
|