Skip Navigation

[Resolved] How to have a blank initial value for a taxonomy dropdown in a CRED form

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

Problem:
A taxonomy dropdown field is included in a CRED form. How to have no initial value selected?

Solution:
It's not possible, there isn't such an option.

This support ticket is created 6 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
- 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 3 replies, has 3 voices.

Last updated by laetitiat 6 years, 11 months ago.

Assisted by: Nigel.

Author
Posts
#605108

I am trying to:

get a taxonomy dropdown (select field) in a cred form to have a default value of ' ' so blank

My parameters in the field currently are

<div class="form-group">
<label>Please select the Award category for this nomination *.</label>
[cred_field field='award' display='select' single_select='true' output='bootstrap' required="true" value=' ' select_text='--- not set ---']
</div>

I expected to see: a select field in the form that is blank as a default.

Instead, I got:
The full list of taxonomies

#605139

Nigel
Supporter

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

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

Hi Gary

I checked this and I'm surprised to see that it's not possible.

The available parameters for the cred_field shortcode don't allow for such a possibility: https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field

The only way for you to achieve it would be a DIY solution where you add a little custom jQuery to insert an empty option element for the select field when the page loads.

If you search "jquery insert option into select" you'll see lots of articles written about how to do that.

If you struggle let me know.

I'm passing this on as a feature request for CRED as I don't see why it's not available already.

#605452

Hi, ok I'll look for a js solution. Thanks for your help.

#910528

Hi Nigel

I would like to know if now it is possible to do it without any custom js solution ?

Thank you.
Regards