Skip to content

Field validation

Beyond Required, a question can ask for a certain kind of answer. These settings live under Advanced in the question’s panel.

Min length and Max length set how long the answer may be. The maximum also stops typing, so nobody writes a long answer only to be told it’s too long.

Format decides what the answer may contain:

Format Accepts
Any text anything (the default)
Letters only letters, spaces, apostrophes and hyphens, like Anne-Marie de Vries
Numbers only digits, like 0042
Letters and numbers letters and digits, no punctuation or spaces
No spaces a single word, like nextforms
Custom pattern whatever your own pattern says

A custom pattern is for answers with a shape only you know: an order number, a member id, an IBAN. You give the pattern and the message people see when it doesn’t match:

Pattern Matches Example
INV-[0-9]{4} INV- and four digits INV-2026
[A-Z]{2}[0-9]{6} two capitals and six digits NL123456
@[A-Za-z0-9_]{1,15} a social handle, @ and up to 15 characters @nextforms
.{8,} at least 8 characters of anything
(yes|no) exactly one of two words

A pattern replaces the length limits: INV-[0-9]{4} is eight characters, no more and no less, so Min length and Max length disappear while a custom pattern is set. Say the length in the pattern instead, like .{8,} for at least 8 or [A-Z]{2,4} for two to four capitals.

Three things to know:

  • The whole answer must match. INV-[0-9]{4} accepts INV-2026 and rejects see INV-2026 please. You don’t need to add ^ and $.
  • Test it before you publish. The Try an answer box under the pattern says Accepted or Rejected as you type. Use it on the answers you expect, and on one you don’t.
  • Patterns are JavaScript-flavoured. If you build one elsewhere, pick “JavaScript” or “ECMAScript” as the flavour. regex101.com is a good place to build and explain one; set the flavour on the left.

A few things aren’t allowed, because they behave differently in different places or can make a form very slow: look-behind ((?<=), named groups, inline flags, back-references and \p{…}. The builder says so as you type, and a form with such a pattern can’t be published.

Paste the pattern only. Regex tools show a pattern wrapped in slashes and flags, like /^[A-Z]{2}[0-9]+$/gm. Paste just the part between the slashes: the builder strips them for you, and left in place they would match nothing at all.

The regex101 library has thousands of ready-made patterns to search. They’re written by other people for all sorts of tools, so treat one as a starting point: paste it in, then run your own answers through Try an answer before you publish.

A question where several options can be picked takes Min selections and Max selections: “pick at least 2”, “pick up to 3”. Respondents are told on the question itself when they’ve picked too few or too many.

A minimum doesn’t make the question required. Leave the question blank and the form still submits; the minimum applies once something is picked. Turn on Required as well if an answer is compulsory.

Single-choice questions have no such setting, since the answer is always exactly one.