Add configurable input validation, length limits and date restrictions to Form nodes

The idea is:

Add advanced field validation options to the Form Trigger and Form nodes for Text, Textarea, Number, and Date fields.
Text and Textarea fields:

  • Configurable Maximum Length property.
  • Optional live character counter (e.g., 245 / 500).
  • Prevent typing or pasting content beyond the configured limit.
    Number fields:
  • Configurable Minimum Digits and Maximum Digits properties.
  • Optional live digit counter.
  • Support exact-length validation (e.g., exactly 10 digits).
  • Handle decimal separators and negative numbers consistently.
    Date fields:
  • Configurable Minimum Date and Maximum Date properties.
  • Support static dates and dynamic n8n expressions or variables.
  • Examples:
    • Today: {{ $now.toFormat('yyyy-MM-dd') }}
    • Tomorrow: {{ $now.plus({ days: 1 }).toFormat('yyyy-MM-dd') }}
    • Workflow variable: {{ $vars.minimumDate }}
  • Disable dates outside the allowed range in the date picker.
  • Validate manually entered dates as well.
  • Respect the workflow timezone.
    Additional validation:
  • Optional regex validation for Text fields.
  • Optional custom validation error messages.
  • Client-side and server-side validation.
  • All new properties should remain optional to preserve backward compatibility.

My use case:

I use self-hosted n8n forms for internal business processes, including approval workflows, requests, data collection, and automated operations.
I regularly encounter situations where input validation is necessary:

  • Text fields: Restrict titles, names, references, or short descriptions to a maximum number of characters.
  • Textarea fields: Limit comments, justifications, or detailed descriptions to a predefined length.
  • Number fields: Require a specific number of digits for identifiers or other structured numeric values.
  • Date fields: Prevent users from selecting dates in the past, or restrict selections to a dynamically calculated date range.
    For example, in an internal request form, I may need to:
  • Limit the request title to 100 characters.
  • Limit the description to 500 characters.
  • Validate a numeric identifier with exactly 10 digits.
  • Prevent selecting a requested execution date earlier than today.
    Ideally, these restrictions should be configured directly within the Form node, without requiring additional workflow nodes or custom HTML forms.

I think it would be beneficial to add this because:

Currently, implementing these validations requires additional workflow logic, custom forms, or validation after submission.
This creates several limitations:

  • Users can submit invalid data before discovering that their input does not meet the requirements.
  • Additional IF or Code nodes are needed to validate values.
  • Invalid submissions require custom error handling or additional form steps.
  • Users receive no immediate visual feedback about character limits or allowed dates.
  • Maintaining consistent validation across multiple forms becomes unnecessarily complex.
    Adding native validation would:
  • Improve the user experience with immediate feedback.
  • Reduce invalid submissions and unnecessary workflow executions.
  • Simplify workflow design and maintenance.
  • Improve data quality before information reaches downstream systems.
  • Make n8n Forms more suitable for professional internal business applications.
    These are standard input validation capabilities commonly available in form-building solutions and HTML forms.

Any resources to support this?

These features could leverage existing HTML validation capabilities:

Are you willing to work on this?

I’m happy to help test this feature, provide real-world use cases, and validate the implementation in a self-hosted n8n environment.
I’m not currently planning to contribute the implementation directly, but I would be glad to provide feedback during development or testing.

+1 for this, especially min/max dates. Until it lands, here’s the workaround I use so bad input never reaches the rest of the workflow:

  1. Form Trigger as usual.
  2. IF node with these conditions (Boolean, “is true”):
    • Date not in the past: {{ DateTime.fromISO($json["Start date"]) >= $now.startOf('day') }}
    • Date not more than 90 days out: {{ DateTime.fromISO($json["Start date"]) <= $now.plus({ days: 90 }).endOf('day') }}
    • Exactly 10 digits: {{ /^\d{10}$/.test(String($json["Phone"]).replace(/\s/g, '')) }}
    • Max length 500: {{ ($json["Comments"] || '').length <= 500 }}
  3. False branch: Form node set to Form Ending, Show Text: “Start date must be between today and {{ $now.plus({ days: 90 }).toFormat('dd LLL yyyy') }}. Please submit again.” with a link back to the form URL.
  4. True branch continues to the real steps.

Two small things: the Date field comes in as yyyy-MM-dd, so fromISO works without a format string, and $now uses the workflow timezone, so set that in workflow settings if your users are in a different zone than the server.