Text field
What it does
A Text field is a one-line box where the visitor types a short answer. You find it in the builder's left panel, in the Text Input group. You add it by dragging it onto the form, as described in Adding fields and sections.
The visitor sees your label above the box and, if you add one, a help text below it. What they type is saved with the submission. To see it, go to Content → WebForms → Inbox and open the submission.
When to use
Choose Text when you only need the typed words, and no other field checks or looks up this kind of answer. Typical uses are a company name, a voucher code or a subject line.
Choose another field when the answer is of a known kind:
- Use Textarea for a message of several lines.
- Use Email for an email address. It checks the format of the address.
- Use Number, Phone or URL for a number, a phone number or a web address.
Settings
Go to Content → WebForms → Manage Forms, click the form's name, then click Form Builder. Click the field on the form. Its settings show in the right panel, on the tabs General, Validation and Appearance. If you don't know these parts of the screen yet, see the Builder tour. You'll change these settings most often:
- Label (General tab) is the name visitors see above the box.
- Required makes the visitor fill in the box before the form can be sent. When you turn it on, Required Error Message appears below Required in the right panel. Type your own wording there to replace the standard message.
- Placeholder is a hint shown inside the empty box. It disappears when the visitor starts typing.
- Help Text is a line of guidance for the visitor. Help Text Position (Appearance tab) shows it below or above the box.
- Default Value fills the box in advance. The visitor can change it.
- Minimum Length and Maximum Length (Validation tab) limit how many characters the answer may have.
- Unique Value (Validation tab) rejects an answer, after the visitor clicks Submit, when an earlier submission already has it in this field. Use it, for example, when each voucher code may be sent only once. It doesn't check whether the code is valid in your store.
- Pattern (Validation tab) checks the answer against a regular expression, a formula that describes allowed text. See Validation rules.
When Required is off, the Validation tab also shows Required Unless This Field Is Filled. Pick another field there, and the visitor must fill in at least one of the two. The table below lists every other setting.
Each change saves into the form's draft at once. Visitors see it after you click Publish Changes in the builder's top bar. To check the form first, click Preview in the same bar.
All settings of this field
| Setting | Where in the panel | Values | Translatable |
|---|---|---|---|
| Enable Field | General → Basic | On or off | No |
| Label (required) | General → Basic | Text | Yes |
| Field Code | General → Basic | Text | No |
| Required | General → Basic | On or off | No |
| Required Error Message | General → Basic | Text | Yes |
| Help Text | General → Basic | Formatted text | Yes |
| Tooltip | General → Basic | Formatted text | Yes |
| Placeholder | General → Field Settings | Text | Yes |
| Default Value | General → Field Settings | Text | Yes |
| Pre-fill with Customer Data | General → Field Settings | Full name, Customer / First name, Customer / Last name, Email, Billing Address / First name, Billing Address / Last name, Company, City, Street, Country 2 symbol code, Region, Postcode, Telephone, Fax | No |
| Hide in Submissions | General → Submission Display | On or off | No |
| Allow in Staff Email Subject | General → Submission Display | On or off | No |
| Submission Label | General → Submission Display | Text | Yes |
| Personal Data | General → Privacy | By field type — Personal data, Not personal, Personal data | No |
| Input Mask | General → Advanced | Text | No |
| Transform Text After Save | General → Advanced | No, Uppercase, Lowercase | No |
| Browser Autocomplete | General → Advanced | Text | No |
| Unique Value | Validation → Unique | On or off | No |
| Error Message | Validation → Unique | Text | Yes |
| Minimum Length | Validation → Length | Number | No |
| Error Message | Validation → Length | Text | Yes |
| Maximum Length | Validation → Length | Number | No |
| Error Message | Validation → Length | Text | Yes |
| Pattern | Validation → Pattern | Text | No |
| Error Message | Validation → Pattern | Text | Yes |
| Desktop | Appearance → Layout | Width: Full (1/1), Half (1/2), Third (1/3), Quarter (1/4), Fifth (1/5), Sixth (1/6), 2/3, 3/4, 2/5, 3/5, 4/5, 5/6; New row: on or off | No |
| Tablet | Appearance → Layout | Width: Full (1/1), Half (1/2), Third (1/3), Quarter (1/4), Fifth (1/5), Sixth (1/6), 2/3, 3/4, 2/5, 3/5, 4/5, 5/6; New row: on or off | No |
| Mobile | Appearance → Layout | Width: Full (1/1), Half (1/2), Third (1/3), Quarter (1/4), Fifth (1/5), Sixth (1/6), 2/3, 3/4, 2/5, 3/5, 4/5, 5/6; New row: on or off | No |
| Show Label | Appearance → Style | On or off | No |
| Help Text Position | Appearance → Style | Below input, Above input | No |
| Container Classes | Appearance → CSS | Text | No |
| Input Classes | Appearance → CSS | Text | No |
| Custom Attributes | Appearance → Advanced | Text | No |
| Inline Style | Appearance → Advanced | Text | No |
Validation
The field doesn't check the answer unless you switch on a rule:
| Rule | What the visitor sees when the check fails |
|---|---|
| Required | "This is a required field." under the box, or your Required Error Message. |
| Minimum Length, for example 6 | "Please enter more or equal than 6 symbols." under the box. |
| Maximum Length, for example 40 | "Please enter less or equal than 40 symbols." under the box. |
| Unique Value | After Submit, a window titled Error that starts with "Duplicate value has been found:" and repeats the answer. |
| Pattern | The Error Message you wrote for the pattern. |
Each rule on the Validation tab has its own Error Message box for your own wording. For Required, use Required Error Message on the General tab.
Unique Value ignores uppercase and lowercase, so "NS1234" and "ns1234" count as duplicates.
Logic
- Show or hide this field: yes. A rule that starts from a field with options, such as a Select, can show or hide a Text field. See Show or hide fields and sections.
- Start a rule: no. Only fields with options can start a rule. A Logic tab appears on a Text field only once a rule shows or hides it, and lists that rule.
- Email conditions: yes. A notification can go out only when the answer matches a condition. The operators are Is, Is Not, Contains, Starts With and Ends With.
Limits
- The box holds one line. For longer answers, use a Textarea field.
- Unique Value compares answers within this one field of this one form. Other forms and other fields don't count.
Troubleshooting
- A visitor sees "Duplicate value has been found". Unique Value is on, and an earlier submission already has the same answer in this field. If repeated answers are fine, turn Unique Value off.
- The visitor sees the standard message instead of yours. For Required, type your text in Required Error Message. For a rule on the Validation tab, use the Error Message box of that rule. Then publish the form.
- Your change doesn't show on the storefront. Changes stay in the draft until you click Publish Changes. See Drafts, publishing and versions.
What's next
- Textarea field: collect a longer message.
- Email field: collect an address you can reply to.
- Validation rules: the length, pattern and unique checks in detail.