Configure the Control Focus Actions
You can use the control focus actions on a view or form to move input focus to a specific control when an event occurs. Use these focus actions to guide people using the view or form, for example when they select Other from a drop-down list, you can set input focus to a Other, please specify text box so they can enter details.
Move focus to text box if Other option is selected from drop-down list
You may want to use the control focus actions in conjunction with the Initialized event to set focus to a control while executing other rule actions in the background. This is especially useful when you have list controls on a view or form that take long to populate. To improve the user experience, you can set focus to a control and use the Initialized event to execute actions such as populating list controls after the view or form has loaded. See Configure the Initialized Event for an example of how you can configure rules to execute at different stages of loading a view or form.
This section illustrates how to configure a control focus action. Use one of the following actions in a rule and select Focus as the method:
- Execute a control's method
- Execute a View control method
- Execute a subview control's method
- Execute a Form control's method that was opened in a subform
- Execute a View control's method that was opened in a subform
In this example, you have a view containing a drop-down control called Ice Cream Drop-Down List. When you select Other from the drop-down list, the focus moves to the Other Details Text Box where you can enter additional details. The rule configuration begins with adding an event for When Ice Cream Drop-Down List is Changed. The rule contains a condition followed by an action.
Follow the steps below to configure the rule shown above.
- Edit the view or form you want to add the rule to, navigate to the Rules page and click Add Rule.
- In the Events tab, click the When a control on the View raises an event rule event in the Control Events section, and then select the Ice Cream Drop-Down List control and Changed event.
- Select the Conditions tab, click the a control contains a specific value condition in the Simple Comparisons section, select the Ice Cream Drop-Down List control and click specify value.
- Type Other in the Value field and click OK. Ensure that this value exists in your drop-down list to prevent any errors.
- Select the Actions tab, click the Execute a control's method action in the Control Interaction section, and then select the Other Details Text Box control and the Focus method. Click OK to save the rule.
- When you use the control focus actions, the control must be visible at runtime when executing the rule action.
- The execution type of the preceding actions are important when using the control focus actions. For example, if the execution type is asynchronous (all at the same time) the control focus action can be overridden by another action. See the definitions of execution types for more information and how it might affect the control focus actions.