(Example) Use Rules in a Form Control
This example shows how to create nested rules to show or hide a form control when a runtime app user selects an item from a drop-down list.
Background and Setup
Result
This example shows how to create the rules that are configured in the Customer Enquiry app to show or hide a form control based on a selection in a drop-down list.
On the Customer Enquiry Request form, in the How do you know about us? list, select Other.
The Other text box shows.
If you select a different value from How do you know about us? list, the Other text box does not show.
Prerequisites
- This example uses the Customer Enquiry app from the AgilePoint NX
App Store.
For more information, refer to How to Get the App.
Good to Know
- Rules have 2 main parts:
- Condition - The circumstances that trigger the rule. The When section of a rule specifies the conditions. Conditions have 3 parts:
- Fields - One or more form controls that trigger or give the context for the condition.
- Comparer - The operator to used to compare the two input values.
- Rule Value - The value or variable that specifies the context for the rules.
- Action - The results that occur if the conditions for the rule are true. The Then section of a rule specifies the actions.
- Condition - The circumstances that trigger the rule. The When section of a rule specifies the conditions. Conditions have 3 parts:
Step 1: Create Rules
Create rules in a form control.
How to Start
- Click App Builder.
- On the App Builder Home screen, click All Apps.
- On the All Apps screen, on the Customer Enquiry app, click Edit .
- On the App Details screen, hover over the Customer Enquiry Form, and click Edit .
Procedure
- On the Customer Enquiry Form, put your cursor over the How do you know about us? Drop-Down List form control, and the form control toolbar shows.
- Click Rules .
- On the Rule Builder screen, create a When statement that specifies the condition for the rule.
In this example, the condition is that the value of the How do you know about us? list is not equal to Other:
- In the Fields section, drag How do you know about us? form control to the When section.
- In the Comparer list, select is not equal to.
- In the Rule Value list, select Other.
- Create a Then statement that specifies the action for the rule.
This action only occurs when the first condition of the rule is true.
In this example, the action is that the Other control is hidden (Hide Control) and optional (Set As Not Mandatory).
- On the Actions section, drag Hide Control to the Then section.
- In the Rule Value list, select Other.
- On the Actions section, drag Set As Not Mandatory to the Then section.
- In the Rule Value list, select Other.
- Click Add Rule.
- Create a When statement that specifies the condition for the rule.
In this example, the condition is that the value of the How do you know about us? list is equal to Other:
- In the Fields section, drag How do you know about us? form control to the When section.
- In the Comparer list, select is equal to.
- In the Rule Value list, select Other.
- Create a Then statement that specifies the action for the rule.
This action only occurs when the second condition of the rule is true.
In this example, the action is that the Other control is visible (Show Control) and required (Set As Mandatory).
- On the Actions section, drag Show Control to the Then section.
- In the Rule Value list, select Other.
- On the Actions section, drag Set As Mandatory to the Then section.
- In the Rule Value list, select Other.
- Select Execute Rules Independently.
This causes the form to execute each condition that is true as if it were a separate rule.
- Select Execute Rules On Form Load Also.
This causes the eForm to execute the rule when the form loads in the web browser.
- Click OK.
The Customer Enquiry Form shows.
Step 2: (Optional) Check Your Configured Rules
Check rules you configured for How do you know about us? drop-down list in Customer Enquiry Form.
Procedure
- Click Preview > PC Browser .
The Customer Enquiry Request form shows in runtime.
- On the Customer Enquiry Request form, in the How do you know about us?
list, select Other.
The Other text box shows.
If you select a different value from How do you know about us? list, the Other text box does not show.
How to Get the App
This example is based on the Customer Enquiry app from the AgilePoint NX App Store. Use this procedure to get the app.
Prerequisites
- AgilePoint NX OnDemand (public cloud), or AgilePoint NX PrivateCloud or AgilePoint NX OnPremises v7.0 or higher.
Good to Know
- This procedure is optional. It is provided so you can test the example with an out-of-the-box app.
- This is part of the Background and Setup procedures, but many users preferred this step to appear after the example, not before it.
Get the App
- Click App Store.
- In the CATEGORY section, click Marketing.
- Click the Customer Enquiry app.
- On the Customer Enquiry screen, click Add.
- On the Trust App screen, click Trust it.
- Click Return to site.