Introduction

The latest How To topics are available in the K2 Five User Guide or the K2 Cloud User Guide’s How to section.

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.

Implementation Details
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.

Image

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.

Image

Changing a Table to Read-Only effectively sets all controls within that table also to Read-Only. 

Example Scenario
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:

  1. Create the following SmartObjects:
    Image
    Image
  2. 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.
  3. Change the Control to a Drop-Down List.
    Image
  4. Click on the ellipsis next to Type in the Data Source section of the Properties and configure some static values. Click OK.
    Image
  5. Click Finish to save the View, then Run the View and capture some data.
    Image
  6. Create an Item View from the Call Centre Task SmartObject.
  7. Edit the Call Centre Task Item View.
  8. Design the layout as follows:
    1. Drag the ID, Call Centre Agent, Priority and Link fields onto the canvas
    2. Insert a Table control
    3. Tick the Read-Only property of the Table
    4. Drag the Progress and Comments fields onto the canvas and then drag the controls over to the right as shown below
    Image
  9. 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.
    Image
  10. 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.
    Image
  11. Select the Progress control and change the control to a Slider control.
  12. 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.
    Image
  13. Click on configure next to the first edit state Action, then select Read-Only for the Table as shown below. Click OK.
    Image
  14. Click on configure next to the second edit state Action, then select Editable for the Table as shown below. Click OK.
    Image
  15. Click Finish and Finish again to save the View.
  16. Generate a Form from the Call Centre Task Item View, then edit the Form.
  17. On the layout step, add two Button controls as shown below. Rename the controls to Submit and View Items
    Image
    .
  18. Select the Submit button and click the Rules tab in the Properties section on the right. Add the following Rule:
    Image
  19. Select the View Items button and click the Rules tab in the Properties section on the right. Add the following Rule:
    Image
  20. Edit the Rule when the subview executed Initialize and add the edit state Action for the subview as shown below.
    Image
  21. Click on configure next to the edit state Action and select all the controls to be Read-Only as shown below. Click OK.
    Image
  22. Click Finish and Finish again to save the Form.
  23. Run the Form.
  24. Try to drag the slider to set a value. The value cannot be set as the table is Read-Only.
    Image
  25. Select an item from the ID drop-down list. The message is displayed as configured in the Rule previously.
    Image
  26. Click OK on the message.
  27. Now try to drag the slider. The slider can be used to set a value as the table is now Editable.
    Image
  28. 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.
  29. 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.
    Image