As per the title. I have a dropdown set up like this:
<div class="form-group">
<label>Crew Member</label>
[cred_field field='@crew-member-crew-certificate.parent' select_text='--- not set ---' class='form-control' use_select2='always' output='bootstrap' author='$current']
</div>
To set a relationship between two post types. However, the above code only outputs the first ten possible crew members, not the full ten. They all have the correct author set etc.
Is there a limitation of ten when using select2 or something?
Hello,
Please elaborate the question with more details:
only outputs the first ten possible crew members, not the full ten
If you need to display all available options, you can disable select2 feature by changing the codes you mentioned above, from:
use_select2='always'
To:
use_select2='never'
More help:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
use_select2 Optional.
Used in parent select fields. Options are always and never.
If I use use_select2='never' another parameter author='$current' stops working- so unfortunately that is not an option.
What more information do you need?
only outputs the first ten possible crew members, not the full ten
Yes. There are 12 crew members who should be in the dropdown, but only the first ten are displayed in the dropdown.
By default the parent select2 selector will output only 10 items, you will need to type some keywords and search.
If you want display more items in the select2 search result, you can use Form filter hook cred_select2_ajax_get_potential_parents_query_limit, for example:
add_filter('cred_select2_ajax_get_potential_parents_query_limit', function($limit){
return 15;
});
Above codes will be able to return 15 items in the select2 search result.
Hi Luo, great- I thought there was some kind of limit. I've added that code, but it doesn't appear to do anything unfortunately. Any ideas why that could be?
You are right, it is another filter hook "cred_select2_ajax_get_potential_relationship_parents_query_limit", please try to change the PHP codes as below:
add_filter('cred_select2_ajax_get_potential_relationship_parents_query_limit', function($limit){
return 15;
});
And test again.
Perfect, that does the trick exactly. Much appreciated!