Skip Navigation

[Resolved] Post Relationship: Connect Post Select Combobox in CRED

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

Problem: I have a CRED form that allows Users to select a parent post. Sometimes a basic select field is used, and other times a combobox is shown so Users can search for posts.

Solution: The combobox appears when 16+ posts are available to select from.

This support ticket is created 6 years, 8 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 4 replies, has 2 voices.

Last updated by Christian Cox 6 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#627160
Screen Shot 2018-03-22 at 02.40.41.png

I successfully created a relationship (beta) and a CRED form that can connect a child to a parent. While in the backend the select box for the connection is a nice combobox, in the CRED form it is a simple select which is rather unconvenient since you cannot properly search for posts.

How can I have the same box functionality in the CRED form as in the backend? Since it works there i feel like this might not be too hard. But I have no idea how to accomplish this.

This is the code used for the CRED form relationship field. I did not find any further options.

[cred_field field='@object-review.parent'  select_text='--- not set ---' class='form-control' output='bootstrap']
#627474

Hi, the CRED parent select combobox feature is set up to be activated when more than a certain number of items is present in the list. How many parent posts exist in your list at the moment? I think a number greater than 15 should trigger the combobox.

#627554
nice.JPG

Thanks, that worked perfectly. 🙂

Just two minor follow up questions: Currently I see no way to translate the part "Please enter 1 or more characters" since it is not yet included in the messages box of the CRED form as an optin. I tried to change it with a Jquery but I fear it fires too late. This did not work:

jQuery(document).ready(function(){
  jQuery('.toolset_select2-results__message').text('ICH BIN EINE NEUER TEXT');  
});

Furthermore. I dont want to reveal the whole list too easily. WI want the user to type in at least 4 characters to trigger the search process. Which file sets this so I can adapt it even if I have to hardcode it.

Thanks in advance 🙂

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/split-customize-select-combobox-options-and-translations/

#627557

Ok i found the hardcoded text in this file:
/wp-content/plugins/cred-frontend-editor/vendor/toolset/toolset-common/res/lib/select2/select2.js in line 4484

var message = 'Please enter ' + remainingChars + ' or more characters';

I also found the variable minimumInputLength which seems to be crucial for this. It is set in line 3745:

this.minimumInputLength = options.get('minimumInputLength');

When i hardcode this as well it already works:

this.minimumInputLength = 4;

But where can I set it generally since it seems like this value is stored somewhere?

Thanks in advance ?

I use the CRED beta.

#628059

Hi, I've split those questions into another ticket since they'll require more than a few sentences to answer.