You can apply a custom validation rule for form fields in WordPress so that the form submission entries meet a certain criterion that you want.
MetForm, Elementor contact form builder, comes with a Field Validation feature that helps you set form validation in WordPress.
Forudsætninger: #
To add the Field Validation for your WordPress forms, you need to have the following plugins installed on your WordPress site:
- Elementor: Download plugin
- MetForm: Download plugin
- MetForm Pro: Hent plugin'et
How to add form validation in WordPress #
For an existing form created with MetForm, you can add validation rule to each of the form fields.
For example, the valid phone numbers are usually 10 to 12 digits (based on the country code). So you can add a form validation rule where the minimum character length for the phone number will be 10, and the maximum character length will be 12.
- Trin 1: Open a form in the Elementor editor.
- Trin 2: Vælg telefon number field.
- Trin 3: Under the content tab, open the Indstillinger afsnit.
- Trin 4: In the settings, select the Validation type to “By character length”. Now you can set the validation rule.
- Trin 5: Set the minimum character length to Min Length.
- Trin 6: Set the maximum character length to Max Length.

That’s it. You have set a field validation rule in the WordPress form.
Now, if a user enters a phone number that is less than 10 digits or more than 12 digits, the form will show an invalid warning to the user.

Like Field Validation support, MetForm comes with tons of advanced form features for WordPress. It is the most flexible Elementor contact form builder that lets you build faster, smoother, and better.
