Skip to main content
formcarry provides server-side field validations so you can enforce data quality rules without writing any backend code. Rules are configured per field in your form’s Settings, and formcarry evaluates every incoming submission against them automatically. When a submission fails validation, formcarry returns an HTTP 422 response with a structured error object that tells you exactly which fields failed and why.

Available Validators


Validation Error Response

When one or more validation rules fail, formcarry responds with HTTP 422 and a JSON body:
The errors object is keyed by field name, making it straightforward to map each error back to the corresponding input in your form.

Displaying Errors in Your Form

You can use the form-error CSS class (or any class of your choosing) to visually highlight inputs that failed validation. The following examples show how to parse the errors object and apply the class to the matching form elements.

Styling Error Inputs

Add a CSS rule for .form-error to give users a clear visual signal that a field needs attention:
This adds a red border and a light red background to any input that failed validation. Adjust the colors and properties to match your site’s design.