How to PDF Form Validation

Form validation in PDFs ensures users enter correct, complete data before submitting — preventing invalid email addresses, out-of-range dates, missing required fields, and incorrectly formatted phone numbers. Validated PDF forms reduce downstream errors, support requests, and manual data cleanup. SublimePDF converts HTML5 validation attributes into PDF-native validation rules.

Follow the step-by-step instructions below, then use the free tool directly — no registration or download required.

Open Tool →

How to PDF Form Validation — Step by Step

1

Mark required fields

Add the required attribute to mandatory form fields: <input type='text' name='fullName' required>. In the PDF, these fields are highlighted (typically with a red border) and must be filled before the form can be submitted.

2

Set input format patterns

Use the pattern attribute with regex: <input type='text' name='phone' pattern='\d{3}-\d{3}-\d{4}' title='Format: 123-456-7890'>. The title attribute becomes the validation error message shown to users in the PDF reader.

3

Constrain numeric ranges

Use min and max attributes on number fields: <input type='number' name='age' min='18' max='120'>. Date fields also support min/max: <input type='date' name='startDate' min='2026-01-01'>. The PDF enforces these constraints on input.

4

Limit text length

Set maxlength to cap character count: <input type='text' name='zipCode' maxlength='10'>. Use minlength for minimum requirements. These translate directly to PDF form field character limits.

5

Add custom validation scripts

For complex validation beyond HTML5 attributes, use data-validate with a JavaScript expression: data-validate='value.includes("@") && value.includes(".")'. The expression returns true (valid) or false (invalid, shows error).

Pro Tips

  • 💡 Provide clear placeholder text (placeholder='Enter email: john@example.com') and title text (used as the error message) on every validated field — users need to know the expected format.
  • 💡 Use type='email' and type='tel' for automatic format validation without writing custom patterns — SublimePDF maps these to appropriate PDF validation rules.
  • 💡 Color-code required fields visually in your template (subtle red border or asterisk) so users can see what's mandatory before attempting to submit.
  • 💡 Test validation in Adobe Acrobat Reader — it's the most reliable viewer for form validation. Other readers may not enforce all validation rules.

Privacy & Security

All processing happens directly in your browser. Your files are never uploaded to any server — they remain on your device throughout the entire process. SublimePDF uses WebAssembly technology for fast, secure, client-side processing.

Works Everywhere

This tool works on any modern browser — Chrome, Firefox, Safari, or Edge — on desktop, tablet, or mobile. No software to install. PDF is an open ISO standard supported by all major platforms.

How to PDF Form Validation — FAQ

Does validation work in all PDF viewers?
Adobe Acrobat Reader and Acrobat Pro fully support validation. Foxit Reader supports most validation. Browser-based viewers and Apple Preview show form fields but typically ignore validation rules.
Can I show custom error messages?
Yes. The title attribute on each form field becomes the validation error message. For example: <input required title='Full name is required'>. For custom validation scripts, return an error string from the data-validate-message attribute.
How do I validate that two fields match (like password confirmation)?
Use data-validate='value === getField("password").value' on the confirmation field. The getField() function accesses other form fields by name in the PDF's JavaScript context.
Can validation prevent the form from being submitted?
Yes. When a submit button is included, Adobe Reader validates all required fields and pattern constraints before sending the form data. Invalid fields are highlighted and the submission is blocked until corrections are made.

Ready to get started?

Use SublimePDF's free tools right now.

Open Tool