Skip to main content
About the Resource Center

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.

  1. Click the Input icon  on the component toolbar. 

  2. 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.

  3. To validate user input, expand the Common group. Then click the Validation list.

  4. Choose Select or Custom to select a method of validation.

    • Select: Select allows you to choose a preset validation pattern. The validation presets are:

      EmailInput must conform to email address syntax.
      AlphabeticAllow alphabetic input only (no numbers).
      Alphabetic – With SpacesAllow alphabetic input only and require spaces between words. For example, “cool beans” is acceptable but “cool_beans” is not.
      Alphabetic – with UnderscoresRequire alphabetic input only (no numbers) and underscores between words. For example, “cool_beans” is acceptable but “cool beans” is not.
      AlphanumericText input must contain both letters and numbers.
      Alphanumeric – With SpacesText input must contain both letters and numbers with words separated by spaces.
      Alphanumeric – With UnderscoresText 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.

  5. 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. 

    1. 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.
  6. To set an action, click No action selected below Change Action in the Advanced property group. 

  7. To select an action, click a row in the list. You can assign a previously defined action or create a new action.

  8. Close the Select Actions list. 

  9. Optionally, set other properties of this component. For example, you can adjust the spacing around this component using margin settings.

    Common

    Layout

    Advanced