Have you ever wished that you had different forms, not only for different kinds of users but for different situations? For example, if an issue's status is "closed" you'd like to require users to fill out the Resolution field. But in any other situation, they don't need to complete this field. In fact, until an issue's closed, users don't even need to see this field.
Quickbase's dynamic form rules allow you create forms that behave differently based on specific conditions. You set the condition and tell Quickbase what action (or actions) to perform using the Dynamic Form Rules tab when you're editing a form.
The following topics describe how dynamic form rules work and provide examples of different types of dynamic form rules:
About Dynamic Form Rules
When you write a form rule, you specify a condition that triggers a rule as well as the action that occurs after the rule is triggered. On the Dynamic Form Rules tab, you set the condition in the When portion of the screen, and the resulting action in the Action section of the screen.
Setting up Conditions
In the When section of the dynamic form rules screen, you define the condition for the rule. The condition is what triggers the rule and is made up of an element, an operator, and matching criteria. You can create conditions based on:
Condition element |
Description |
---|---|
Field values |
Triggers the rule based on the value entered or selected in a particular field. |
The user |
Triggers the rule based on the role of the user editing the form. |
The record |
Specifies that the rule should be triggered either when the record is opened or when it is saved. |
Setting multiple or additional conditions
You can choose to set multiple conditions. In this case, Quickbase displays extra controls which let you set several conditions at once.
When you choose multiple conditions, you can specify whether all or only some of the conditions must be met to trigger the action. To apply additional conditions, click the Add Condition button on the upper right of the rule designer pane.
If you don't select Multiple Conditions, you can still set multiple conditions by clicking the button on the upper right of the rule designer pane. When you do so, Quickbase lets you specify conditions that also must be met—in addition to the first condition.
About setting multiple conditions on a for single element
When two or more dynamic form rules show or hide the same element, you should combine them into one rule, using the Multiple Conditions selection
Why? When multiple rules show or hide the same element, later rules interfere with those that fire earlier. To work correctly, each form rule has an inverse statement that tells Quickbase what to do when a rule's conditions aren't met. When you create or select a rule, you can see this inverse in the Otherwise section just below Actions.
For example, if you were to create a rule that specifies:
When Package Type is Fragile, show the Special Handling section
you'd see that part of that rule is also:
When Package Type is not Fragile, hide the Special Handling section
That's fine until a second rule comes along. Say that a later rule reads:
When Package Type is Oversize, show the Special Handling section.
The "otherwise" portion of this rule specifies that:
When Package Type is not Oversize, hide the Special Handling section
So, if Package Type is Fragile when the second rule runs, Quickbase would hide the Special Handling section, even though that contradicts the first rule. The later rule has the last word and "word" is that Fragile is not Oversize.
What you'd really like to say is:
When Package Type is Fragile or Package Type is Oversize, show the Special Handling section.
To do so, create one rule which includes multiple conditions, specifying that any can be true.
Defining actions
The second part of a Quickbase rule is the action that should occur when the specified condition is true. You can specify the following actions:
Action |
Description |
---|---|
Show |
Displays a field on the form when the condition is true. |
Hide |
Hides a field, section, or tab from the form when the condition is true. (Note that you can choose to collapse the space on the form when you hide fields.) |
Require |
Specifies that a field should become required when the condition is true. When a field is required, Quickbase will save the form only when a valid value is entered in the field. |
Unrequire |
Specifies that a field should become optional when the condition is true. |
Make read-only |
Specifies that a field should not accept data when the condition is true. |
Make editable |
Specifies that a field should become editable when the condition is true. |
Change |
Changes the value in a field when the condition is true |
Display a message |
Displays a customized message when the condition is true. |
Change |
Available only when creating rules that fire when a record is opened or saved. Specifies that a value in a field should change to a specific value you specify. |
Abort the save |
Available only when creating rules that fire when a record is opened or saved. Specifies that Quickbase should not save the record when all conditions are true. |
Specifying how Quickbase should handle Change actions
When you set up an action to Change a field value, you can specify when you want the field value to be changed using the fire "change" actions only when a condition changes from false to true checkbox.
Select this checkbox if you want Quickbase to change the field value only when the condition changes from false to true.
To understand how this works, consider this very simple form, used to track the inventory of a product.
You could write the following form rule to set the Re-order flag:
As you set up your business, you might want to enter "placeholder" information for new products, before you are really ready to order inventory. In these cases, the Total inventory value would automatically default to 0, making the condition in the rule true.
However, because the fire "change" actions... option is selected, the rule will fire ONLY when the condition CHANGES from false to true; that is, the Re-Order flag will be set ONLY when the total inventory goes from some number greater than 100 to a number less than 100.
Here's how the fire "change" actions... option affects the behavior of this form when you enter a record for a new product.
When the fire "change" actions option is... |
...what happens to the Re-order field? |
Why? |
---|---|---|
Checked |
The Re-Order field remains unchecked.
|
The condition When Total inventory < 100 was ALREADY true when I opened the form. (Total inventory defaults to 0.) It did not change from false to true when I entered the record. The rule will fire ONLY when the Total inventory changes from a value equal to or greater than 100 to a value less than 100. |
Unchecked |
The value in the Re-Order field is set to Checked |
Quickbase evaluates and triggers the rule whenever either condition is true. Since 0 < 100, Quickbase automatically sets the Re-Order field to checked. |