Skip Navigation

[Gelöst] Post Relationship: Connect Post Select Combobox in CRED

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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 vor 6 Jahren, 7 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

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)

Dieses Thema enthält 4 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Christian Cox vor 6 Jahren, 7 Monaten.

Assistiert von: Christian Cox.

Author
Artikel
#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 🙂

Neue Threads, die von Christian Cox erstellt wurden und mit diesem verbunden sind, sind unten aufgeführt:

https://toolset.com/de/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.