Skip Navigation

[Resolved] How to pre-select cred_fields in Toolset Forms

This thread is resolved. Here is a description of the problem and solution.

Problem:
Taxonomy fields are added to a Form. Can default values be set?

Solution:
Default values is only supported for custom fields, using the value attribute, not for taxonomies.

Relevant Documentation:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field

This support ticket is created 5 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+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by StanleyT8485 5 years, 7 months ago.

Assisted by: Nigel.

Author
Posts
#1262415

Tell us what you are trying to do? I want to pre-select cred_fields in Toolset Forms.

How can I do this?

#1262463

Nigel
Supporter

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

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

Screenshot 2019-06-07 at 14.52.01.png

When editing the form fields you can provide a default value.

See the screenshot, where I have a "status" field which is a select dropdown. I can provide a default value (that matches the option value, not the display value) here and then the corresponding select option would be pre-selected when the form loads.

If you are using Expert Mode you can add a value attribute to the field (https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field)

#1262493

How can we do this for Woocommerce product categories? hidden link

And can we also do this for custom taxonomies? I tried entering the value but it doesn't select the option - hidden link

#1262507

Nigel
Supporter

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

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

Here's the relevant entry for the documentation I linked to:

value. Optional. Preset value (translated automatically if WPML translation exists). Must match the expected Field's syntax. For example, date fields require a valid timestamp instead of a date string. Does not apply to all field types, e.g. taxonomies.

Providing default values for taxonomies is not supported, I'm afraid.

You can run some code triggered by a hook such as cred_save_data to apply defaults once the form has been submitted, but the only way to pre-select values in the form fields themselves would be to run some custom JS that marks them as selected once the form has loaded.

#1263469

My issue is resolved now. Thank you!