Skip Navigation

[Resolved] mark first_name and last_name as required

This support ticket is created 7 years, 7 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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

This topic contains 1 reply, has 2 voices.

Last updated by Nigel 7 years, 7 months ago.

Assisted by: Nigel.

Author
Posts
#431973

I am trying to:
Mark the fields first_name and last_name from the users form as required

I visited this URL:
A lot of them

I expected to see:
some flag in the [cred_field] shortcode

Instead, I got:
one [cred_field ... required="true"] that upon further investigation, didn't work.

What I have resolved so far:
I created first-name and last-name user fields which can be marked as required but because they aren't the official ones the name is missing from mailing and other plugins that required them.

I also tried creating user fields with the same name to see if it would override the default ones but it also didn't work.

#432423

Nigel
Supporter

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

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

Here is the reference for the cred_field shortcode used to add the fields to the form: https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field

You will see that required is not one of the parameters, and cannot be set on the form fields.

Being required or not comes from the field itself—as set up in Types. So, as you have discovered, you can create a User Field in Types and mark it as required, and this will be enforced in the CRED form (as well as in the back end editing pages).

But Types can't set standard WordPress fields as required.

To get CRED forms to perform custom validation, including of standard WordPress fields, you would need to write some custom code that hooks into the custom_form_validate filter. See the documentation here:

https://toolset.com/documentation/user-guides/cred-api/#cfv

If you need help with that then please let me know.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.