Using the pxButton control rule
Summary
Introduced in V6.1 SP2, the auto-generated control rule pxButton is used in the Button control. This rule incorporates a large variety of pre-configured actions that are easily implemented in section, harness, and flow action rules, in both repeating and non-repeating layouts. The button can trigger:
- Action types that were available in the V5.4+ button control and the pzGridAction gadget.
- Actions in navigation rules (available from the navigation editor's Action tab on the Node Details window).
- New actions such as launching a harness from a work object.
You configure the button's appearance and behavior using the control rule's Parameters dialog. The default settings represent the basic configuration. However, you need to specify what action will run when the user clicks the button in a work form. For example, you can configure the button to:
- Start a local action (see How to use a button control to display a modal dialog)
- Add or delete rows in a repeating list
- Open an assignment
- Expand or collapse sections
- Open a wizard
In addition, the Parameters dialog lets you:
- Add a label, tooltip, or image
- Define conditions that, when not true, disable or hide the button
Your edits apply only to the button within the context of the section that contains it and do not update the underlying pxButton rule. You can add any number of buttons to a section, each with its own look and function.
This article provides an example that shows you how to use the Parameters dialog to configure a button.
Suggested Approach
Assume that you want a user to be able to edit properties in a repeating list that contains stock price information. In this example, you will create buttons with these prerequisites:
- Allow users to enter or delete items in the list.
- Restrict these functions to users who are both administrators and hold the privilege to update a report in a specified application.
- Display images that describe the buttons' function.
Do the following:
Set grid to inline edit mode
- Open the layout in the section that you want to update and display the wireframe.
- Click the magnifying glass icon () next to header in the Repeat Grid header to open the Repeat Grid properties panel.
- In the Edit Mode drop-down list, select
Inline
as shown here.
The displayed data appears in read-only mode. When the user double-clicks a row, the editable fields in that row display as editable.
Add the Button control to the layout
- From the Basics group, drag and drop the Button control into an action-area cell.
- Click the magnifying glass icon () next to the cell to open the button's Cell Properties panel.
- In the panel, select the magnifying glass icon () next to the Control field. This displays the Button control Parameters dialog, which contains the relevant fields from the pxButton rule form's Control tab.
Modify the button's appearance
- Enter the text
Add
in the Label field. (As a best practice, start the text with a verb). If the Localize? checkbox is selected on the harness or section rule's HTML tab, a SmartPrompt appears in the field. If you plan to localize the text, select a field value rule with pyButtonLabel as the second key part. - Enter the text
Add company name
in the Tooltip field. If localization is enabled, select a field value rule with pyActionPrompt as the second key part. - Click the magnifying glass icon () next to the Image field to open the Image Viewer. In this example, the file
webwb/add.gif
is selected.
Add security
- Select the Disabled Yes radio button. This displays the Disabled Condition field.
- Select the standard when rule named hasAdminRole in this field.
- Select the standard privilege rule named UpdateLimitedForm in the Privilege field. When you enter the privilege, the When Not Met field appears.
- Select
Disable
from the drop-down list. Here are the fields when completed.
A user can add an item who has both an administrator role and holds the privilege to access this harness (limited to the application defined in the rule). Otherwise, the button is disabled.
Define the action
- In the Behaviors area on the Parameters dialog, click the add row icon (). The Behavior dialog appears.
- Select
Click
from the Event drop-down list.
- Click the Select... menu in the Action section. An array of action categories appears.
- Select Handle List Items > Add Item.
The menus close and the Position field appears in the Behavior dialog.
- In the field, select
Before
in the drop-down list. - Click OK to close the Behavior dialog. The Parameters dialog looks like this.
- Click OK to save your edits and close the Parameters dialog.
- Save the section.
Test your Button control
Before you begin, configure your operator access group so that the security settings evaluate to true. Run the flow that uses the section containing the grid.
- When the report appears, hover your mouse pointer over the button to display the tooltip. Click the button to display the new row (which appears at the top of the list).
- Select a row in the report and click the button again. The new row appears above the row you selected.
- Reconfigure your operator access group so that the security settings do not evaluate to true and test again. Clicking the button should not open a row.
- Add a Delete button using the same procedure described above. Modify the button label, tooltip, and image. For the action, use the Handle List Items > Delete Item menu item. Here is example of the finished button in the report.
You cannot use the pxButton control in a harness's bottom cell. Drag and drop the Button control from the Basics group and configure it using the V5.4+ configuration method. See How to configure a local action in a button (V5.4+ harness rules).