Text Area

The textarea element is a field for multi-line text input, allowing users to edit multiple lines of plain text. Text areas are useful to collect or edit runs of text like messages, opinions, reviews, articles, etc.

Attributes

Attribute

Type

Required?

Description

name

String

Yes

Identifies the text area.

placeholder

String

No

Specifies a short hint that describes the expected value of the text area.

required

Boolean

No

If true, it specifies that the text area must be filled out before submitting the form. Accepted values; true and false.

pattern

String

No

Regex String to match for input validation

pattern-error-message

String

No

Error message returned to user if pattern parameter matches user input

title

It accepts a simple text and \n for line breaks

No

The description that will be displayed when clicking the tooltip icon located on top of the Masked Text Field Element. Max length: 256 characters. Available from Symphony v20.8 and above.

label

String

Not required but it is recommended if title is defined

Definition of the label that will be displayed on top of the Masked Text Field Element. Available from Symphony v20.8 and above.

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 must be a self-closing tag or have no children.

  • You can add a default text in your text area by including it between the <textarea></textarea> tags. Note that unlike the placeholder text, the default text will be sent with the form if not edited by the user. Refer to Examples for more information.

Examples

The following example shows two textareas being used as follows:

  • The first textarea (id1) 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 (req) shows how a placeholder text ("Required, with a placeholder, a regex, a label, and a tooltip") 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. It shows as well the behaviour of a required textarea in a form, which cannot be submitted in case it is not filled; an error is displayed under the textarea in case the user submits the form with this empty field. The textarea presents how a label text ("My Label") as well as a title text ("My Tooltip/n With a second line") are displayed in the UI. Finally, it shows how users can interact with a regex pattern which does not allow the form to be submitted if the input does not follow the pattern required by the bot developer.

MessageML
Datafeed Payload
MessageML
<messageML>
<form id="form_id">
<h2>textareas</h2>
<textarea name="id1" >With initial value</textarea>
<textarea name="req" required="true" label="My label" title="My title\nWith second line" pattern="^[a-zA-Z]{3,3}$" pattern-error-message="My error message - must contain exactly 3 letters" placeholder="Required, with a placeholder, a regex, a label, and a tooltip"></textarea>
<button name="textarea">Submit</button>
</form>
</messageML>
Datafeed Payload
[
{
"id": "wPptaz",
"messageId": "LI4WgwZSDcstpKjyeKvCH3___pQEQvHfbQ",
"timestamp": 1563296599584,
"type": "SYMPHONYELEMENTSACTION",
"initiator": {
"user": {
"userId": 7078106482890,
"firstName": "User",
"lastName": "Bot",
"displayName": "User",
"email": "[email protected]",
"username": "user_bot"
}
},
"payload": {
"symphonyElementsAction": {
"actionStream": {
"streamId": "0YeiA-neZa1PrdHy1L82jX___pQjntU-dA"
},
"formStream": {
"streamId": "YuK1c2y2yuie6+UfQnjSPX///pQEn69idA=="
},
"formMessageId": "1P6z5kI6OzkxTKEoKOgWZ3///pQERpkYdA==5338",
"formId": "form_id",
"formValues": {
"action": "textarea",
"id1": "",
"req": "abc"
}
}
}
}
]

Versions and Compatibility

Main features introduced

Client release

Backward client-compatibility behavior (e.g. external rooms)

Agent needed to parse message sent by the bot

Initial release

1.55

Not working

2.55.9

Regex

20.6

Regex validation not enforced but field can be submitted

20.6

Label

20.9

Label displayed and form can still be submitted

20.7

Tooltip (title)

20.9

Tooltip not displayed but form can still be submitted

20.7