Skip Navigation

[Resolved] Difficulty customizing cred_field in forms

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by Minesh 5 months, 3 weeks ago.

Assisted by: Minesh.

Author
Posts
#2700521

Hello, I am following official documentation

https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/

I have noticed that many parameters do not work, or work only under VERY specific conditions. Actually, if I'm understanding correctly, there wouldn't be many more freedoms in expert mode than in the visual builder

For example I need a hand with a particular cred_field which is taxonomy with hierarchy. The user has to choose a single option (chexboxes would not work, even if single selection is requested) then I am run type 'select'

The problem is that the list is unordered, it is simply ordered by order of creation of each element in the taxonomy. I would like it to be alphabetical

I would also need to apply a placeholder, I am manipulating an internal element with JS and the user will likely see a strange word change or movement. A placeholder would help me look more serious and confident. So, following the documentation, the shortcode should be written something like this:

[cred_field field='city' force_type='taxonomy' output='bootstrap' display='select' single_select='true' placeholder='Please select a City' order= 'title' ordering='desc']

But it doesn't work, it appears ordered by term creation date and placeholder does not appear

Please help

#2700522

Sorry, I'm a little tired, I can confirm that, in fact, the alphabetical order is established by default and that the documentation specifies that the placeholders are only for the text fields

In my case the ability for no option to be selected by default would be enough. Is it possible to achieve this?

Thanks greetings

#2700617

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I understand - do you want to add the placeholder - default option for the taxonomy select field that is added as select dropdown? If yes:

You can add the following code to your Form's JS box:

jQuery(document).ready(function($){
  
jQuery("select[name='city[]']").prepend('<option value="0">-choose-</option>');
jQuery("select[name='city[]']")[0].selectedIndex = 0;

});
#2701296

Interesting thanks, as including CSS and JS editor, several solutions can be implemented