Caution: Note when upgrading AForms from v1 to v2.

Conditional (labeling logic)

AForms provides conditional branching in a unique way called “labeling logic”.

The basic philosophy is “If the user does something special, put a label on the user”. Then “control the form components by looking at the labels attached to the user”.

I’ll give you an example because I think it’s easier to explain with examples.

Case 1: Provides additional choices in a later item only to users who have chosen a particular choice

For example, such as that of DELL, on a BTO PC customization form, the logic is that only a user who chooses Windows 10 Pro can customize the memory to 32GB or more.

In this case, when Windows 10 Pro is selected when selecting the OS, the label “pro-edition” is attached to the user. And when he/she selects memory, he/she can select 32GB memory only if it is labeled “pro-edition”.

To actually build a form in this way, enter “pro-edition” in the “Label” field of the Windows 10 Pro option, and enter “pro-edition” again in the “Required label” field of the 32 GB memory option.

Case 2: Discount a user with an order amount over a certain amount

In this case, use “Price Checker Item”.
The price checker item is a component that monitors the order amount and attaches a label when it meets the specified conditions.
For example, if the order amount is 1,000USD or more, you can attach a “large-price” label.

To add a detail to an estimation only when it has a specific label, use “Auto Item” with “Required Label”.
For example, use an “Auto Item” with the name “discount”, the amount “-50”, and the required label “large-price”, then only the user attached the “large-price” label to will get a discount line of -50USD.

Labels and Components

Information as of AForms1.0.1.

Components that can be used to attach labels

  • Option
    Options of Selector Items can attach labels when the user chooses the option. Enter the name of the label you want to attach in the “Labels” field.
  • Price Checker Item
    Labels can be attached when the estimation amount meets certain conditions (such as over $nnn or under $nnn). Enter the name of the label you want to attach in the “Label” field.

Components that can be controlled by labels

  • Auto Item
    “Auto Item” is a component that allows you to add a detail line without showing the input field to the user. but they can be controlled by a label. If you write the name of the label in the “Required label” field, the detail line will be added only when the label is attached.
  • Option
    You can control “Option” of “Selector Item” with labels. If you write the name of the label in the “Required label” field, the options are enabled only when the label is attached. (If the label is not attached, the user can not select it.)

If two or more labels are written in the “Required Labels” field, all of them must be attached before the condition is met.

Label specifications

  • Characters that can be used for labels are Alphabets, numbers, hyphen “-“, and underscore “_” (all ASCII characters). The ASCII space ” ” before and after the label is removed from the label name.
  • Separate multiple labels with a comma “,”.
0 0