Setting up of Custom Validation Rules

[ad_1]

When a user inputs data into a record, a validation rule checks that it complies with the standards before the user saves the record. The Custom Validator provides the input control with a user-defined validation function.

A validation rule accepts input in the form of an expression or formula that helps validate the data entered and produces the output True or False. When an incorrect value is displayed, the Validation Rule additionally shows an error message.

So, if you’re trying to figure out how to set up a custom validation rule on your website, please utilise our plugin and follow the guidelines below.

1. Navigate to **WooCommerce → Checkout Form → Advanced Settings.**
2. Proceed to ​​**Custom validators**
3. Four fields are displayed to fill in.

* **Validator Name:** The unique name provided for the validation that gets stored inside the database to identify the validator.
* **Validator Label:** The name that gets displayed for the validation rule.
* **Validator Pattern:** This field gives input for the validation. Expressions or formats are provided for the validator pattern and are followed using the **Regular Expression** or **Regex**.
* **Validator Message:** This shows the message regarding the input and the output. When the input does not match the output, the message will be displayed as an invalid message.

4. Click on the “**+”** icon for adding new custom validation rules.

5. Click **Save changes**.

For example;

* The Regex value for email is given as **/\^\[a-zA-Z0-9$/**.

For the created field, **custom**, the created validators will be available in the Validations drop-down.

​

**Note:** When the custom field does not match with the validation, the message generated is **“Invalid”** as shown below**.**

​

Thus, through this post, we believe that you can set up the custom validators feature on the checkout page using the Checkout Field Editor for Woocomerce by ThemeHigh.

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer