Skip Navigation

[Resolved] default value

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/Karachi (GMT+05:00)

This topic contains 5 replies, has 2 voices.

Last updated by Waqar 9 months ago.

Assisted by: Waqar.

Author
Posts
#2689323

hello,

I would like a default value for :
[cred_field field='category' force_type='taxonomy' output='bootstrap' display='select' single_select='true']

It's possible ?

Thank you

#2689423

Hi,

Thank you for contacting us and I'd be happy to assist.

The 'cred_field' shortcode doesn't support setting a default value for the taxonomy field.

To set a default value, custom script can be used, as explained in this other support thread:
https://toolset.com/forums/topic/cred-blank-empty-default-value-for-taxonomy-select-field/

regards,
Waqar

#2689521

I try thus but it doesn't work.

jQuery(document).ready(function($) {
jQuery("select[name='news[]']").prepend('<option value="">- Select -</option>');
jQuery("select[name='news[]']")[0].selectedIndex = 0;
jQuery("select[name='news[]']").attr("required","");
});

Thank you

#2689540

Can you please share the link to the page where this script is not working?

#2689550

Yes, here :
hidden link

Thank you.

#2689563

Thank you for sharing the link.

If your goal is to preselect the option 'News' (option value '43'), you can replace that custom script with:


jQuery(document).ready(function($) {
	jQuery('select[name="category[]"] option[value="43"]').prop('selected', true);
});