Switch

The switch. One setting, two states, and a boolean value stored as is. For a binary choice on a form it reads faster than a lone checkbox.

What it is

TypefieldToggle
Categoryform
Children allowed0
Styling targetsbspk, input, label
EventsonChange

The settings

Only the settings specific to this block are listed here. The block name, HTML id, anchor, conditional display and repetition are shared by every block and described once, under Shared settings.

Parameters

SettingHow it is setWhat it doesSpecifics
4D code for the field name
vb_Use4dCode
toggle (boolean)The field name is a 4D expression evaluated at render time: its result becomes the field name sent with the formdefault: no
Field name
vt_FieldName
text (text)—required

Label & texts

SettingHow it is setWhat it doesSpecifics
Right
vb_RevertLabel
toggle (boolean)—default: no
4D code for label
vb_Use4dCodeForLabel
toggle (boolean)—default: no
Field label
vt_FieldLabel
text (text)—translatable

Input & behavior

SettingHow it is setWhat it doesSpecifics
Display like a checkbox
vb_DisplayLikeCheckbox
toggle (boolean)—default: no
Show unchecked when disabled
vb_FalseWhenDisabled
toggle (boolean)A setting with no effect must not look active: it would suggest a behaviour that never happens. The stored value is left untouched.default: no
Is linked to the module entity?
vb_isLinkedToModuleEntity
toggle (boolean)—default: no
Relationship path
vt_HowGetPk
text (text)Path from the page entity to the one actually holding the value — e.g. Entity.MyCustomer. Left empty, the value is read on the page entity.
Disabling condition
vt_QueryDisabled
text (text)4D formula: when true, the toggle is greyed out and cannot be changed. Use it to neutralise a setting that depends on another one.accepts 4D
4D value
vt_Value
text (text)—accepts 4D

Validation

SettingHow it is setWhat it doesSpecifics
Required field
vb_Required
toggle (boolean)—security check, default: no
Required condition
vt_QueryRequired
text (text)Only read when the field is already marked required: the expression then decides, on each validation, whether it truly is. Must return a boolean. Skipped on a plain block reload.

The tables on this page are produced automatically from the block's schema. If this page and the panel disagree, the schema is right.