Text input script component
The text input component prompts the agent for text input and can validate the text. You can bind the value of a text input component to a variable.
- Click the Input icon on the component toolbar.
In the properties panel, use the Placeholder box to prepopulate the control with a prompt that tells the reader what to type. Variables never store placeholder text. Placeholder text is temporary text that instructs the agent, and it is replaced automatically by user input. For example:
You can prepopulate the field with the value of a variable. To do so, select a variable from the Value list in the component properties. The value automatically displays to the user at run time. The value of the variable automatically updates with text that the user types, subject to optional validation.
To validate user input, expand the Common group. Then click the Validation list.
Choose Select or Custom to select a method of validation.
Select: Select allows you to choose a preset validation pattern. The validation presets are:
Email Input must conform to email address syntax. Alphabetic Allow alphabetic input only (no numbers). Alphabetic – With Spaces Allow alphabetic input only and require spaces between words. For example, “cool beans” is acceptable but “cool_beans” is not. Alphabetic – with Underscores Require alphabetic input only (no numbers) and underscores between words. For example, “cool_beans” is acceptable but “cool beans” is not. Alphanumeric Text input must contain both letters and numbers. Alphanumeric – With Spaces Text input must contain both letters and numbers with words separated by spaces. Alphanumeric – With Underscores Text input must contain both letters and numbers with words separated by underscores. Custom: If a prepackaged validation is not sufficient, you can use a regular expression to validate text input. Select Custom from the Validation list. Then, enter a regular expression in the text box. Regular expressions are beyond the scope of this topic. But, suppose for example, that you want the user to enter the phrase “dog” somewhere within a text input. Typing
dog
in the custom validation property sets up a simple regular expression that accepts dog, sundog, hotdog, my good dog Penny, or other combinations of characters that contain that case-sensitive string, but not DOG Doggie, and so on.Another example is
^[a-z]+$
to accept lowercase alphabetic characters only.Tip: The Internet offers many resources for learning about regular expressions. Examples are http://www.regular-expressions.info/ and https://en.wikipedia.org/?title=Regular_expression.When focus leaves the text box, the value of the text input component is validated to ensure that it conforms with the selected validation rule. If user input does not pass validation, borders turn red to indicate a validation problem. You can test custom and prepackaged validations in the editor’s preview mode.
Set the Requires Value switch to Yes if the user must type a value into the component. By default, this setting is No, which means that user input is optional.
- Set the Requires Value switch to True if the user must type a value into the component. By default, this setting is False, which means that user input is optional.
To set an action, click No action selected below Change Action in the Advanced property group.
To select an action, click a row in the list. You can assign a previously defined action or create a new action.
Close the Select Actions list.
Optionally, set other properties of this component. For example, you can adjust the spacing around this component using margin settings.
Common
Layout
Appearance
Advanced
[NEXT] Was this article helpful?
Get user feedback about articles.