BreezingForms: Elemente nur bedingt anzeigen

Um Elemente in BreezingForms bedingt anzeigen zu lassen, wie folgt vorgehen:

  • Einen „Schalter“ einrichten: das heisst, ein Element (Radiobutton, Checkboxen) welche angeklickt werden müssen (siehe Bild).
  • Nun die Felder, welche ein-/ausgeblendet werden sollen einrichten und unter den erweiterten Einstellungen diese „AUSSCHALTEN“. Dies bewirkt, dass diese Felder beim Aufruf des Formulars erstmals ausgeschaltet (nicht angezeigt) werden (siehe Bild).
  • Die Steuerung der ganzen Anzeigen erfolgt im Formularbereich unter „Erweitert“ (siehe Bild). Hier die Formeln eingeben.

 Eine Anleitung in englisch findet sich hier.


Formelschnippsel:

– Radio Group:

Example: turn on element mytext if myradiogroup is on

Once one or more rules are set involving your radiogroup, each click on a radio button will trigger your rules. If one ore more rules are matching the values defined in your group definition the rule will be applied.

– Checkbox

Examples:

turn on element mytext if mycheckbox is !checked

turn off element mytext if mycheckbox is !unchecked

The single checkbox is special and only knows about the state commands that are indicated using a leading !. So if the checkbox is „!checked“ the rule will be applied to „mytext“. Same goes for „!unchecked“

– Checkbox group

Examples:

turn on element mytext if mycheckbox is !checked

turn on element mytext if mycheckboxgroup is somevalue

turn off element mytext if mycheckboxgroup is !unchecked

The checkbox group works basically the same as the radio group or, to be more precise, is a mix between radiogroups and single checkbox (including a little addition). Please note though, that the ‚and‘ and ‚or‘ functionality does not currently apply to the checkbox group. If you want to allow multiple boxes to be checked or unchecked, but to clear only when there are no boxes checked, then your rules should be defined as follows:

turn on element mytext if mycheckboxgroup is somevalue

turn on element mytext if mycheckboxgroup is someothervalue

turn on element mytext if mycheckboxgroup is anothervalue

turn off element mytext if mycheckboxgroup is !unchecked

– Select (single and multiple)

Examples:

turn on element mytext if mycheckboxgroup is somevalue

turn on element mytext if mycheckboxgroup is #somevalue|someothervalue

turn on element mytext if mycheckboxgroup is #somevalue;someothervalue

The select element knows about testing against a single value or the any command (#somevalue|someothervalue, see checkbox group). It additionally provides the and-command (#somevalue;someothervalue): All these values must be selected before the rule fires.

– Textfield/Textarea

Examples:

turn on element mytext if mycheckboxgroup is somevalue

turn on element mytext if mycheckboxgroup is ![0-9]$

Text can be triggered by finding a certain value or by a regular expression indicated by the command marker (!). The rules will be applied on blur, this means you won’t get a result before the user leaves the textfield or textarea.

NOTE: Since 1.7.2 build 737 it is also possible to give elements a value, depending on the on/off state of a section/element.

The syntax is:

if element ELEMENTNAME is off set TARGETELEMENT VALUE if section SECTIONAME is on set TARGETELEMENT VALUE
While the special rule
if element ELEMENTNAME is off set TARGETELEMENT !empty

will empty the TARGETELEMENT.

The rules should come after the regular visibility rules.

These rules are element-type safe. Means, that it also works for select-lists, checkbox- and radio-groups.

So for these element types you simply would enter the desired value to check/select the element.