Form Input Behaviors

From jVantage

Jump to: navigation, search

jVantage provides an advanced and powerful feature for controlling the behaviors of fields that appear on input forms. The field input behavior tool allows you to specify rules that impact the behavior of input fields based on the content of other fields on the same form.

To do this, simply create rules in sentence form that spell out this condition. jVantage will then carry out these rules by generating JavaScript and embedding it into the appropriate forms automatically. As you define rules, they are listed in the bottom portion of the page. You may view the generated JavaScript by selecting the show JavaScript link.

Inverse Rules and Rule Ordering

Be aware that rule execution may not always produce the results you expect. For instance, let's say that you have created an online car lot application and you want to disable the engine size option on vehicle entry forms when users specify a vehicle type of motorcycle. If a user specifies motorcycle and then chooses to change back to a passenger car you must have an inverse rule to re-enable the engine size option. Without an inverse rule, there is nothing to enable the engine size field after his been disabled. To define an inverse rule, instead of selecting the Add Rule button, simply select the Add with Inverse Rule button after defining your rule. This causes the rule to be added along with a secondary rule that un-applies the first rule.

The order in which rules are listed is also significant. Let's say that your online car lot also sells bicycles. Now you would like to expand the previous rule to disable the engine size field when the vehicle type is motorcycle or bicycle. If you add an individual rule and inverse rule for a motorcycle and for a bicycle, the logic would be carried out as follows.

As the rules are executed according to Illustration 15, regardless of the outcome of the logic that deals with motorcycles, it will be overridden by the bicycle logic. Let's say we enter into the application flow at point one and we are looking at a motorcycle. When we get to the first condition, which asks if the vehicle is a motorcycle, we will see that it is, and disable the engine size field. Then we will pass into the bicycle logic. At that point we will determine that since the vehicle type is not a bicycle, the engine size field should be enabled.

To get the behavior we want, we simply have to rearrange the way that this logic is written as follows.

Rather than creating a motorcycle rule with an inverse rule and a bicycle rule with an inverse rule, we would first simply enable the engine size field and then selectively disable it only if the vehicle type is either a motorcycle or a bicycle.

Personal tools