HomeGuidesRecipesAPI
HomeGuidesAPILog In
Guides
These docs are for v16. Click to read the latest docs for v31.

Text Field

Overview

The Text Field question is the most common question type. Users are provided with a basic text box to type a response to a question or instruction, as follows:

Usage

How to create a Text Field question:

From the toolbox, drag and drop a Text Field question onto a page, section column or tab and set the question’s properties as below.

PropertyDescription
Question TextThe title of the question
Text PositionThe position in which to display the Question Text on the form. The options are:

- Top
- Left
- Floating
- (None)
MandatoryChecking this box will make the question mandatory. It is unchecked by default.
Default ValueSets a default value for the Text Field when it appears in Produce. Default values can contain:

- Any text including numbers or dates.
- A named date such as ‘tomorrow’.
- References to other questions.
Data TypeSet the data type to one of the following:

- Text
- Date
- Number
- Email
- Password
- Currency
- Phone Number
- Time
Character limitYou can type in a character limit which will set the maximum number of characters allowed.

Note: The default character limit is 500. This property allows up to 5 digits with a maximum limit of 99999 characters.
Width (Pixels)This will set the maximum number of pixels wide the field will be.
Text RowsThe number of rows that are displayed to the end user in Produce. By default, only one row is displayed.
WatermarkA watermark displays a placeholder value of an HTML input textbox until the user has provided some valid text. Watermarks are not the same as default values as they are used purely for informative/example purposes and don't count as a repose to the question. i.e. If no input is made to a text field displaying a watermark, the actual field content is considered to be blank.

If those cases where the text field has a default value, then the watermark will not be displayed unless the user deletes the current text.

Note: IE does not show the watermark when the textbox has focus, other browsers do. IE8 and 9 do not support this feature natively but it is simulated through JavaScript.
Help TextHelp text can be added to give additional information about what is being requested in the question. This is a rich-text box.
CommentsCheck this box to allow comments. It is unchecked by default.
StyleThe options are:

- Alert (error)
- Alert (info)
- Alert (success)
- Alert (warning)
- Jumbotron
- Label (default)
- Label (error)
- Label (info)
- Label (primary)
- Label (success)
- Label (warning)
- Well
Find DependenciesClicking this link will open a pop-up window that will show any dependencies that this label has.

📘

Default Time Format

Default time format is 24 hour time (HH:mm). Standard date formats can be applied to the Time type Text Field at the answer level.

From the Placeholders tab, drag and drop the necessary bookmarks or tags onto the answer.

Text Field Question Reference Defaults

Data collected by the question set can be reused as the default value of other Text Field questions. For example, a client’s surname could be the default for their partner’s surname. This process involves using a question reference as the default value.

In addition to referencing a Text Field question, it’s possible to reference a field retrieved from a data-driven question such as a data field. For example, if a customer’s details are retrieved from a customer database and used as the default values of Text Field questions, you can enable users to accept or change the retrieved data as needed prior to its inclusion in the document.

Default values can only reference questions that appear before the current question in the question set. To set up a reference, populate the question’s default value property with a question reference.

Text Field Validation

To ensure the quality of user input, SmartIQ enables you to apply validation rules to Text Field questions. If the end user enters an invalid response to the question, SmartIQ will display an error message. For example:

Infiniti provides three validation types as described in the table below:

Validation TypeDescription
CompareCompares a user’s response to a value, calculation or a preceding question. For example, the compare feature could be used to ensure that:

- an applicant is over a certain age
- a price is between $0.00 and $1,000.00
- a delivery date is no more than 10 days after the purchase date
- a parent was born before their children
- an order number begins with ‘ORD00’
Field LengthField length validation limits the question response to a minimum and/or a maximum number of characters in length. This can be used to ensure a name is less than 50 characters long, or a code is exactly four characters.
Regular ExpressionInfiniti supports regular expression matches for complex data validation. For example, to ensure an email address is in the correct form complete with @ symbol.

How to create Text Field validation rules

Select the Text Field question you wish to validate and navigate to the Validation tab.

Select a Validation Type from the drop-down list and enter an Expression for the validation. An expression can be a constant value, question reference, calculation, or regular expression. Some examples are provided below:

ValidationType (Comparison)/Expression
Greater than 100Compare (Greater Than)
100
Begins with ABCCompare (Begins With)
ABC
Happened on or after 01/01/2000Compare (Greater Than or Equals)
#01/01/2000#
Delivery date is after invoice DateCompare (Greater Than)
[q1]
Applicant is at least 18 yearsCompare (Less Than or Equals)
DateAdd(0,-18,today())
Valid email addressRegular Expression
[-._\w]+@[-._\w]+.\w+

📘

Note

that dates as expressions must begin and end with ‘#’ or they will be processed as a calculation with the ‘/’ being used as a division symbol. Also note that question references must reference a preceding question.

Enter a meaningful error in the Message property otherwise a default message will be displayed. An error message such as ‘Value must be between 1 and 100’ is much better than ‘Invalid value’.

📘

Note

The Message property can include question references to build messages dynamically, e.g. '[q2] is an invalid date'.

Click Add to store the validation rule.

Comma-separated number or value formatting

To format numeric values the following format string or similar can be applied:

###,###,##0.00

📘

Note

Be sure to have at least one '0' in your formula. Otherwise, your '0' will resolve to '' (empty) in your generated document.

Validating and Formatting Phone Numbers

🚧

Selecting the Phone Number data type does not automatically apply validation, as the desired/allowed formats may vary significantly between projects. Selecting this data type only prompts mobile browsers to present the user with a "number input" keyboard instead of a normal "text input" keyboard. Validation of the entered data should be done via the same methods as for the Text data type.

Phone numbers are generally formatted according to a standard, for example:

Landline: (02) 6280 6244

Mobile: 0404 111 333

Simple validation

A simple way to achieve phone number formatting is to validate the question in Produce so that the user is forced to enter 10 digits with no spaces.

📘

Note

If phone numbers in your area start with a 0, a number field will not work as the browser will remove leading 0's (Real numbers don't start with 0)

Set your text field data type to 'Number' and a character limit. On the validations tab, set a minimum length. Finally, once it can be ensured that the number will be entered as a 10 digit string, a format string can be applied so it appears correctly in the document.

Advanced validation

Where a phone number might start with a 0 or require characters such as ( ) + you will need to set your Text Field data type to text. Validating a phone number with these requirements can be difficult and specific to a local area.

You can make use of a regular expression by selecting the validation tab in Design and selecting the type 'Regular Expression'.

Warning: Regular expressions are a powerful yet complex form of validation. It is recommended that any use of regular expressions for validation is tested thoroughly

Validates an Australian Mobile number - 0411 234 567

^\({0,1}((0|\+61)(4)){0,1}\){0,1}(\ |-){0,1}[0-9]{2}(\ |-){0,1}[0-9]{2}(\ |-){0,1}[0-9]{1}(\ |-){0,1}[0-9]{3}$

Validates an Australian Phone Number - including area code - (02) 6280 6244

^\({0,1}((0|\+61)(2|4|3|7|8)){0,1}\){0,1}(\ |-){0,1}[0-9]{2}(\ |-){0,1}[0-9]{2}(\ |-){0,1}[0-9]{1}(\ |-){0,1}[0-9]{3}$

Numbered Lists (Ordered Lists) In Question Text

A typical numbered list can be created as question text using the following HTML tags.

<ol>
 <li>Coffee</li>
 <li>Milk</li>
 </ol>

Decimal place validation

If you need your form project to capture numbers that must have a specific number of decimal places, you can add Regular Expression validation in Design. The following regular expressions will validate to the noted number of decimal places:

1 \d+(.\d{1,1})?
2 \d+(.\d{1,2})?
3 \d+(.\d{1,3})?
4 \d+(.\d{1,4})?
5 \d+(.\d{1,5})?
6 \d+(.\d{1,6})?

Ensure answers start with capital letter

If a response to a text field question must start with a capital letter, the following regular expression validation can be applied:

📘

Note

Make sure that a meaningful error message is applied to avoid confusion (i.e. surname must start with a capital letter).

If answers must start with a capital letter

If a response to a user prompt question must start with a capital letter, the following regular expression validation can be applied:

To make this happen, do the following:

  1. In the right navigation, select Validation.
  2. In the Expression section, add the following [A-Z]{1}.*

📘

Note

Make sure that a meaningful error message is applied to avoid confusion (i.e. surname must start with a capital letter).

Named Date

SmartIQ allows keywords to be used inside of date text fields to select certain dates. This is useful if the required date is unknown. For instance, SmartIQ Produce can interpret a set of commonly named dates if a certain date is unknown.

For example, the "today" keyword may be used to input today's date.

Named Dates can also be used in Design as the default value for date text field questions and validation.

Available Named Dates:

ChristmasChristmas eveday after tomorrowday before yesterday
eastereaster Sundayeaster SundayFriday
good Fridaylast weeklast yearMonday
new yearsnew years daynew years evenew years eve day
next Fridaynext Mondaynext Saturdaynext Sunday
next Thursdaynext Tuesdaynext yearpast year
todaytomorrowTuesdayWednesday
x-masx-mas evexmassx-mass
xmass eveyesterday

📘

Note

This Feature is built into the Produce user interface and will only work for projects that are loaded in Produce. Fully automated projects that run outside of Produce should avoid this feature.

Setting width for Text Field

A width can be specified for a Text Field's text box and is set in terms of pixels. This feature reduces the usage of space by a particular field.

Example

SmartIQ web form which contains three Text Fields: Postcode, Email, and Address with widths set as 75px, 250px and 400px respectively.

Text Field - Aligning currency & numbers to the right

In Design, Text Fields set to either currency or number can be aligned to the right. By default, this setting is OFF. However, to force right alignment, the relevant property must be set.

Steps

1.Go to Design and open the relevant project.
2.Choose the relevant Text Fields.
3.In the Properties tab at the bottom of the screen, check the Right Align checkbox.

📘

Note

This is displayed for currency and numbers only.

Text Field- Password Data Type

In Design, open any project and add a Text Field. For passwords, it can be configured via the Data Type Pulldown:

Complete the remaining part of the Text Field as normal;

In Produce, Setting a Text Field as a Password will have the following effects:

  1. When typing into the password field, the characters will be hidden.
  2. When being redisplayed the password field will always show 6 characters if there's more than one character typed in (they're #s behind the scenes). The value of the question will remain unchanged (whatever the user typed in).
  3. If you type into the field, and then leave it (resetting it to ######), the next time you type a character the field will be cleared (preventing people from pressing backspace and then typing something and ending up with their password being "####ri" or something similar).
  4. The value of the password field will be encrypted in Answer Files, but if you put in a question reference the reference will be unencrypted (such as if you're passing the password to an Action).