Field Validation: Stop Cleaning Up Bad Data After the Fact
January 13, 2026
Your staff spends hours every week fixing data that was entered wrong. Phone numbers with missing digits. Insurance IDs that are actually group numbers. Email addresses with typos. Dates written as "next Thursday" instead of an actual date.
The fix isn't better data cleaning. It's better data collection. Custom field validation catches these problems while the patient is still filling out the form, when they can actually correct them.
What You Can Validate
Length Limits
Set minimum and maximum character counts. A "reason for visit" field that requires at least 10 characters prevents one-word answers like "checkup." A maximum length on a notes field keeps responses manageable.
Regex Patterns
Regular expressions let you enforce specific formats. This is where validation gets powerful:
Email: ^[^\s@]+@[^\s@]+\.[^\s@]+$ ensures there's an @ sign and a domain.
Phone number: ^\+?[\d\s-()]+$ accepts common phone formats while rejecting text.
Date (YYYY-MM-DD): ^\d{4}-\d{2}-\d{2}$ enforces a specific date format.
Alphanumeric ID: ^[A-Za-z0-9]+$ restricts to letters and numbers only. Useful for insurance policy numbers or medical record IDs.
Custom Error Messages
When validation fails, the patient sees your message, not a generic "invalid input" error. "Please enter your 10-digit phone number including area code" is infinitely more helpful than "Validation failed."
How to Set It Up
- Select the field in the form builder.
- Toggle on "Add custom validation rules" in field settings.
- Set your rules: min length, max length, regex pattern, error message.
- Test with valid and invalid inputs to make sure it works.
That's it. No code, no backend changes.
Writing Good Error Messages
This is where most forms fail. The validation rule itself can be perfect, but if the error message is confusing, patients either give up or enter garbage data to get past it.
Good error messages follow a pattern: tell the patient what you want, not what they did wrong.
-
Bad: "Invalid format"
-
Good: "Please enter your phone number as (555) 555-5555"
-
Bad: "Field does not match required pattern"
-
Good: "Insurance ID should be 2 letters followed by 8 digits (e.g., AB12345678)"
Include an example when the expected format isn't obvious. Patients shouldn't have to guess.
Finding the Right Strictness Level
Validation that's too loose doesn't help. Validation that's too strict frustrates legitimate users. The goal is to catch clear errors without rejecting valid data.
For example, a US phone number regex that only accepts (555) 555-5555 will reject 555-555-5555 and 5555555555, both of which are perfectly valid inputs. Build your patterns to accept reasonable variations.
When in doubt, validate format loosely and validate content strictly. Accept phone numbers in multiple formats, but require exactly 10 digits.
Healthcare-Specific Patterns
Some validations come up repeatedly in medical forms:
- Insurance policy numbers: vary by carrier, but you can validate length and character type
- Medical record numbers: enforce your practice's specific format
- NPI numbers: 10-digit numeric format
- Date of birth: date picker fields handle this, but text fields need format validation
The Compound Effect
Each validated field saves a small amount of cleanup time. Across hundreds of submissions per month, it adds up fast. A practice processing 500 intake forms monthly that spends 2 minutes per form on data correction is burning over 16 hours a month, just fixing things that validation could have prevented.
Clean data at the point of entry means clean data everywhere downstream: in your EHR, your reports, your billing system. Fix it once at the source.