Text Field
Text input fields are the most common elements in a form. Symphony provides two types of elements for text input fields: Text fields are for a single-line input; and Text area is for multi-line input.
Attributes
Attribute | Type | Required? | Description |
| String | Yes | Identifies the text field. |
| String | Optional | Specifies a short hint that describes the expected value of the input field. |
| Boolean | Optional | If |
| Boolean | Optional | If |
| Integer | Optional | The |
| Integer | Optional | The |
| String | Optional | Regex String to match for input validation. For more information, refer to Regular Expressions - Regex. |
| String | Optional but if | Error message returned to user if |
| It accepts a simple text and | Optional | The description that will be displayed when clicking the tooltip icon located on top of the Text Field Element. Max length: 256 characters. Available from Symphony v20.8 and above. |
| String | Not required but it is recommended if | Definition of the label that will be displayed on top of the Text Field Element. Available from Symphony v20.8 and above. |
| Boolean | Optional. Default false. | When enabled, typing < |
Using Input Validation
With Symphony v20.6, bot developers can use Regex to validate text fields
and text areas
using the pattern
and pattern-error-message
attributes.
For more information and examples, refer to Regular Expressions - Regex.
Rules and Limitations
The text field has a max number of 128 characters. For larger texts, use Text Area.
The text field cannot have children tags but it can have a default text (initial value) between the
<text-field></text-field>
tags. See Examples below for more details.Text fields are grouped at a max of 4 per row, depending on the screen size. For more information, refer to Alignment of input texts.
You can add a default text in your text field by including it between the
<text-field></text-field>
tags. Note that unlike theplaceholder
text, the default text will be sent with the form if not edited by the user.Input Validation - Pattern: the max length for all attributes is set to 256.
Examples
The following examples show text fields being used as follows:
The first text-field (init) shows how to display a default text ("With initial value"). Note that the default text would have been sent to the payload if it had not been deleted before submitting the form.
The second text-field (placeholder) shows how a placeholder text ("Only Placeholder") is displayed in the UI. Please note the placeholder text is not sent in the payload if no text has been entered in the field by the enduser.
The third text-field (noreq) shows how a user can interact with a non-required field. Even if the field is empty (only a placeholder text is present but does not count as a value), it does not prevent the enduser from submitting the form.
The fourth text-field (req) shows the behaviour of the unique required field of the form, which cannot be submitted in case it is not filled; an error is displayed under the field in case the user submits the form with this empty field.
The fifth text-field (regex) shows the behaviour of the field when a regex pattern is entered. You can note that the pattern-error-message is displayed under the field if the input does not follow the pattern required by the bot developer.
The sixth text-field (min) shows how to force users to enter an input with a minimum number of characters, and how an error message is displayed under the field if the input does not respect the minlength required.
The seventh text-field (label) shows how a label text ("My Label") is displayed.
The eighth text-field (tooltip) shows how a title text ("My Tooltip/n With a second line") is inserted in the UI under the (i) icon, and how the text entered in the title parameter is displayed when the enduser clicks on the icon.
Alignment of text-fields
Please note that several text-fields are aligned next to another. Note also that this behaviour is reactive to the screen size, the number of text-fields on the same line decreasing until one per row, as the screen gets smaller (see in the example below).
Versions and Compatibility
Main features introduced | Agent needed to parse message sent by the bot | Client 2.0 release | Mobile |
---|---|---|---|
Initial release | 2.55.9 | Since first version | Since first version |
Regex | 20.6 | Since first version | Since first version |
Label | 20.7 | Since first version | Since first version |
Tooltip (title) | 20.7 | Since first version | Since first version |
auto-submit | 23.11 | 23.12 | Not supported yet. |
Last updated