Skip Navigation

[Resolved] Validation for fields – for forms and for admin

This support ticket is created 2 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by simchaH 2 years, 11 months ago.

Author
Posts
#2271461

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!

#2271979

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

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.

#2276939

Thank you for adding this thread!