Hello,
I am wondering what is the built-in standard for validating custom fields in Toolset? Both, by adding a post in the admin area and by using the form in the frontend, I wanted to know what are the preset validations used for the fields are, and if I can edit them at all?
For example, for the number custom field, there are many ways to input a phone number so I want to make it only one way - IE 18008008000 , 1800-800-8000 , 1800.800.8000 - I am trying to minimalize anomalies in the system so I would like one main validating method for each field.
Thank You!
The field validation is a mix of JavaScript and server-side validation, depending on whether you are editing posts in the back end or with a front-end form, but there is no possibility to modify the built-in validation, the patterns for which are effectively hard-coded.
If you want an alternate form of validation you should not select validation in the custom field settings, and then apply your own custom validation.
It is easy enough to add custom JS to a Toolset Form, and you can use the Forms API to add server-side validation (https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate).
On the back-end post edit screens you would need to use the core WP hooks for back-end validation and could enqueue your own custom JS to provide inline validation.
We do have an existing feature request to add flexibility to Toolset's in-built validation, and I'll add this thread to that internal ticket to add your voice to the request.
Thank you for adding this thread!