View Article

Make a Control Read-Only Based on a Condition

By Xelence Documentation posted 09-02-2021 12:21

  

Introduction

Just like making a whole form read-only based on a rule, you can make a control read-only based on a rule condition. The rest of the form will still be editable (as long as no read-only rules evaluate to true); just that one control will change.

The process is also similar to making a form read-only: create a rule defining the condition, then enter that rule in the control's read-only property.

Prerequisites

  • The entity must exist.
  • The maintenance form must exist.
Quick Steps
1 Search for and open the entity
2 Open the Conditions section, open the Expression section, then add a new expression
3 Enter the Name (ID), then click OK
4 Add a new condition
5 Enter the expression details
6 Save the entity
7 Search for and open the form
8 Open the control properties
9 Enter the Read Only Rule
10 Save the form

Detailed Steps

Step 1. Search for and open the entity.

The form's entity is where you configure its validations.



Step 2. Open the Conditions section, open the Expression section, then add a new expression.

Click the plus icon to create the expression.




Step 3. Enter the Name (ID), then click OK.

Give your expression a descriptive name. You will have lots of validations and you want to be able to identify each one at a glance.




Step 4. Add a new condition.

Click the Add Condition button to add a new condition.




Step 5. Enter the expression details.

The first field identifies what the expression is comparing. Options are:

  • Query: Entity query.
  • Attributes: Entity attribute.
  • Rule: Entity rule.
  • Regx: Pattern that can be selected to search for.
  • Condition: Inserts another condition in your expression as long as it's part of the same entity.

The next field is the specific item, such as the name of the attribute.

The third field is the operation the application will use for the comparison.

Operators are: In, NotIn, Like, Contains, Exists, Between, IsFalse, IsNull, IsTrue, IsNotNull, IsEqualTo, IsNotEqualTo, IsLessThan, 
IsLessThanorEqualTo, IsGreaterThan, and IsGreaterThanorEqualTo.

The fourth field identifies what the expression is comparing to. Options are:

  • Query: Entity query.
  • Attributes: Entity attribute.
  • Rule: Entity rule.
  • Constant: Fixed value to compare to.

The last field is the specific comparison item, such as the Constant of Y.

This example uses an expression that is true if the Birth Certified Flag is equal to Y (is checked).


The condition is added in the entity.



Step 6. Save the entity.



Step 7. Search for and open the form.

Open the form with the control you want to configure.


Step 8. Open the control properties.

This is the control you want the rule condition to make read-only whenever its condition is true.

Drag and drop the Birthcertifiedflag from the entity. The control has been changed to checkbox.


Update the checkbox properties.



Step 9. Enter the Read Only Rule.

The Read Only Rule is the expression you just defined.




Step 10. Save the form.


Then, run the Preview. Xelence displays the form output. You can test your updated settings.

When you have previewed your form, it should look something like this. In this case, when Birth Certified is checked, Birth Date is read-only after saving the record.


What are the improvements over S3 Version 6?

Previously, the expression was added in the Initial Load section of the Validation Rules. Now, the expression is added under the Conditions section. And multiple group expression conditions can be added using And, Any, Not operators.


This post is part of the Maintenance Form topic. Click here to open the Maintenance Form Overview.


#Xelence

#Forms

0 comments
125 views