I am trying to: Have ALL parent options appear in dropdown without having to start typing part of the word
Link to a page where the issue can be seen: hidden link (district field - top left)
I expected to see: ALL parents appear there
Instead, I got: Some (random?) selection of options
Hi, there are two options for this dropdown:
1. The typeahead / autosuggest option you described
2. A standard select field
With the standard select field, all published parent posts will be displayed as options. However, there is no typeahead field so searching can be a bit cumbersome. With the typeahead field you get the autosuggest option, but you cannot see all parent posts at first. You can switch between the two options by adding or removing use_select2="never" from the cred_field shortcode attributes:
Typeahead field: [cred_field field="@book-chapter.parent" class="form-control" output="bootstrap" select_text="--- not set ---"]
Standard select field: [cred_field field="@book-chapter.parent" class="form-control" output="bootstrap" select_text="--- not set ---" use_select2="never"]
There is also a minimum number of results required to display the typeahead style input field. If there are fewer than I think 16 options, a standard input field is shown.
Thanks, Christian. That worked to pull all the parents.
One additional question:
when I use the new code:
field='@district_demographic-data.parent'
I can't get the sort or to be alpha by name despite adding order='title' ordering='asc' it seems to disregard those settings.
Only if I use the old
field='_wpcf_belongs_district_id' will it link in ascending alpha order.
What am I missing?
It turns out that order and ordering are only supported when use_select2 is set to "always". It's mentioned the documentation here:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
Oh. That seems pretty limiting. As it is I have to choose between having a full drop-down list or proper ordering? Or use the old code. Is there a plan to extend ordering to other use_select2 settings?
As it is I have to choose between having a full drop-down list or proper ordering? Or use the old code.
Correct, or write custom code that accomplishes exactly what you want. I don't know of a plan to extend ordering into the basic relationship select field. If you'd like to see that added to the software, I encourage you to submit a feature request here: https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
Our management will consider the request and decide if it's something we can implement.