Keypad
What is the Form Keypad?
The keypad form type generates a customizable grid of buttons with different input behaviors. The buttons, their layout, and per-button behavior are all defined from the Values setting.
Options
General
- Rows
- Columns
- Select Type
- Max Entry
- Values
Specifies the number of rows to be generated. The possible value is in the range: 1 - 40. The default is 4.
Specifies the number of columns to be generated. The possible value is in the range: 1 - 40. The default is 3.
Defines how the keypad operates. The default is Check. Possible values:
- Input: Works like a keyboard; buttons do not stay pressed and each press appends its value to the output text.
- Check: Works like checkboxes; buttons stay pressed until toggled off, and every pressed value is collected into the output.
- Radio: Works like radio buttons; only one button can be pressed at a time and it stays pressed.
- Simple: One button can be pressed, but it will not stay pressed.
Defines the maximum number of entries allowed. Once reached, no new buttons can be pressed and a
-max-entry-reachedsensor event is fired. The possible value is in the range: 0 - 25. The default is 0, which means unlimited.
Specifies the values for the buttons. Values are separated by new lines or semicolons (';'). Each value becomes one button, filling the grid left to right, top to bottom. Button behavior is customized with the modifiers listed below.
Button Modifiers
The keypad supports various button modifiers, defined using square brackets. The modifier tags are stripped from the rendered label and only change the button's behavior or appearance. Multiple modifiers can be combined on the same button.
- [!] - Disabled button (cannot be pressed).
- [-] - Empty cell (renders a blank, inactive space; no button is generated).
- [*] - Pressed by default.
- [c] - Clear button. In Input mode it removes the last character of the output (acts as a backspace). In Check, Radio, and Simple modes it clears all pressed buttons and the output.
- [ce] - Clear entry button. Clears all pressed buttons and the output in every mode.
- [enter] - Fires the current output as a
-enter-pressedsensor event. In Check mode the enter button's own value is not added to the output text. - [space] - Inserts a white space (only works in Input mode).
- [number] - Defines the button colspan (how many columns it spans). Overflow at the end of a row is clamped to the remaining columns.
- [msg:message] - Fires the given message as a
-button-messagesensor event when the button is pressed. - [icon:icon name] - Displays a Material Font icon before the label.
- [value:value] - Specifies a custom button value (the exported value, which can differ from the visible label).
- [background:color] - Specifies a custom button background; accepts any HTML color value.
Modifier Precedence Table
When several behavioral modifiers are present on one button, the highest-priority one decides what the press does:
| Order | Input | Check | Radio | Simple |
|---|---|---|---|---|
| 1 | Clear | Clear / Clear Entry | Clear / Clear Entry | Clear / Clear Entry |
| 2 | Clear Entry | Enter / Value | Enter / Value | Enter |
| 3 | Enter | - | - | Value |
| 4 | Space | - | - | - |
| 5 | Value | - | - | - |
Styling Options
- Button Rounding
- Distance Between Buttons
- Vertical Alignment
- Button Color
- Button Shadow Color
- Pressed Button Color
- Pressed Button Font Color
- Select Button Background Image
Defines the button corner radius. The possible value is in the range: 0 - 50. The default is 5.
Defines the spacing between buttons. The possible value is in the range: 2 - 20. The default is 4.
Sets the vertical alignment of the button content. The default is Top. Possible values:
- Top
- Center
- Bottom
Sets the button background color. The default is
#2e8ef7.
Sets the button shadow color. The default is
#666666.
Sets the background color of pressed buttons. The default is
#2e8ef7.
Sets the font color of pressed buttons. The default is
#000000.
Selects an optional background image rendered on every button. The default is empty (no image).
Setting Mock Field and Own Value
The keypad stores an object containing:
-
text: The accumulated output text.
-
pressed: The array of the pressed buttons' indexes.
-
The own value is set to the text string, while the mock field receives the full object (text and pressed).
-
The keypad writes to the Mock field and own value:
- initially, on load
- after each button press
- when an external message changes its state.
Output examples
Input:
"ExampleKeypad": {
"text": "output text",
"pressed": []
}
Check:
"ExampleKeypad": {
"text": "a, b, c",
"pressed": [0, 12, 10]
}
Radio:
"ExampleKeypad": {
"text": "value",
"pressed": [5]
}
Simple:
"ExampleKeypad": {
"text": "another value",
"pressed": []
}
Validation
The keypad does not perform validation. It has no correct/incorrect concept, does not emit a -valid event, and does not draw a validation border.
Sensor Events
The keypad generates sensor events upon interaction. All events are prefixed with the form's name (FORM-NAME) and are only fired on the displayer.
FORM-NAME
- Triggered when the keypad writes to the Mock DataSource.
- Value is the output object. For example:
{
"text": "1, 2, 3",
"pressed": [0, 1, 2]
}
FORM-NAME-text-value
- Value is the output object's text value.
- Triggered whenever the keypad writes to the Mock field (initially and after every button press).
FORM-NAME-button-pressed
- Value is the pressed button's value. Note that the value is not necessarily the same as the label.
- Triggered after every button press (regardless of modifiers).
FORM-NAME-changed
- Value is the new output object's text value.
- Triggered when the output text changes.
FORM-NAME-button-message
- Value is the button's message.
- Triggered when a button with the
[msg:...]modifier is pressed.
FORM-NAME-enter-pressed
- Value is the output object's text value.
- Triggered when a button with the
[enter]modifier is pressed.
FORM-NAME-max-entry-reached
- Value is the configured Max Entry value.
- Triggered when the max entry limit is reached.
External Messages
The keypad listens to three external messages:
- Set Form: Takes the value from the message, parses it exactly like the Values setting (splitting on new lines / semicolons and applying the same modifiers), and rebuilds the keypad with the new buttons. Updates both the Mock and Own values.
- Clear Form: Clears the output text, un-presses all buttons, and writes the cleared value to the Mock and Own values.
- Reset Form: Clears the output and re-parses the configured Values, restoring the keypad to its initial state.
Value from Datasource
The keypad does not bind to an external datasource to generate its buttons; the buttons come only from the Values setting (or a Set Form message). On load it restores its previously exported value (text and pressed indexes) from the form output store, if one is present.