Controls and tables can be set to Read-Only in the Properties section of certain controls. In addition, Rules can be configured to change the edit state of the control or table. This Knowledge Base article describes how to configure Rules in order to change the edit state of controls and tables used in Views and Forms.
A new Rule Action has been added in order to set the Read-Only property in a rule. The "edit state" Actions can be found under the Control Properties section of the Actions.
Clicking on configure next to the edit state Action will display all of the controls (and Views, if the Rule is on a Form) and allow you to change the property from Read-Only to Editable. Leaving the Unchanged option selected will keep the control's state as designed by the designer in the Layout step.
Changing a Table to Read-Only effectively sets all controls within that table also to Read-Only.
We are using a Call Centre Task scenario where items can be actioned and a list of the items available can be opened in a subview. In the scenario, we are configuring the table at the bottom of the View to be Read-Only and once confirmation is received from the user to action the item, the table becomes editable. If the user chooses not to action the item, the table remains Read-Only. To change the edit state of the table, Rules are configured using the Control Properties section of the Actions in the Rule Designer.
Follow the steps below to set up the scenario as described above:
- Create the following SmartObjects:
- Generate an Editable List View from the Call Centre Items SmartObject, then edit the View and select the Type Add/Edit Item on the Layout screen.
- Change the Control to a Drop-Down List.
- Click on the ellipsis next to Type in the Data Source section of the Properties and configure some static values. Click OK.
- Click Finish to save the View, then Run the View and capture some data.
- Create an Item View from the Call Centre Task SmartObject.
- Edit the Call Centre Task Item View.
- Design the layout as follows:
- Drag the ID, Call Centre Agent, Priority and Link fields onto the canvas
- Insert a Table control
- Tick the Read-Only property of the Table
- Drag the Progress and Comments fields onto the canvas and then drag the controls over to the right as shown below
- Select the ID field, click on the Change Control icon and select Drop-Down List. Click OK. Click on the ellipsis next to Type in the Properties section.
- Configure the Data Source as shown below. Click OK. The Call Centre Items SmartObject will be used to populate the ID field of the Call Centre Task Item View.
- Select the Progress control and change the control to a Slider control.
- Go to the Rules step and add the Rule as shown below. The “edit state” Actions can be found under the Control Properties section of the Actions.
- Click on configure next to the first edit state Action, then select Read-Only for the Table as shown below. Click OK.
- Click on configure next to the second edit state Action, then select Editable for the Table as shown below. Click OK.
- Click Finish and Finish again to save the View.
- Generate a Form from the Call Centre Task Item View, then edit the Form.
- On the layout step, add two Button controls as shown below. Rename the controls to Submit and View Items
- Select the Submit button and click the Rules tab in the Properties section on the right. Add the following Rule:
- Select the View Items button and click the Rules tab in the Properties section on the right. Add the following Rule:
- Edit the Rule when the subview executed Initialize and add the edit state Action for the subview as shown below.
- Click on configure next to the edit state Action and select all the controls to be Read-Only as shown below. Click OK.
- Click Finish and Finish again to save the Form.
- Run the Form.
- Try to drag the slider to set a value. The value cannot be set as the table is Read-Only.
- Select an item from the ID drop-down list. The message is displayed as configured in the Rule previously.
- Click OK on the message.
- Now try to drag the slider. The slider can be used to set a value as the table is now Editable.
- Select an item from the ID drop-down list again and click Cancel on the message. Note that the slider cannot be dragged to set a value as the table is Read-Only when choosing not to edit the item.
- Click on the View Items button. The Call Centre Items Editable List subview is opened and the data is displayed. Note that the data cannot be edited as the controls are Read-Only.