Skip Navigation

[Resolved] Default value on a Select field

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

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Puntorosso 3 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#1933259

I have a form to create new users, with a select field to set the user role (customer/seller).
This select field have different values/labels

LABEL VALUE
Käufer customer
Verkäufer seller

Using a custom code I set the role once the form is saved.

Now, if I want to change this user, through an edit form, which is the best way to populate a generic select field with the proper user role?
Thanks

#1934587

Hello,

There isn't such kind of built-in feature within Toolset Forms plugin.

You will need to consider custom codes, for example, setup a custom shortcode to get current user's roles:
https://codex.wordpress.org/Shortcode_API
https://stackoverflow.com/questions/39593273/user-roles-shortcode

Then pass it to Toolset Forms generic field shortcode as "default" parameter:
https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_generic_field

#1938413

My issue is resolved now. Thank you!