? Pending

User tests: Successful: Unsuccessful:

avatar laoneo
laoneo
23 Nov 2016

Summary of Changes

If a list in the global configuration doesn't contain 10 items but it should support to add custom values, then it doesn't work. To fix that, the search thrashhold should be set to 0.

A side effect will be that every list will be searchable in the global configuration.

Testing Instructions

Add the following XML code o the file administrator/components/com_content/config.xml after line 6.

	<field name="demo" type="list"
		default="bs2" class="chzn-custom-value"
		label="Demo">
		<option value="bs2">BS2</option>
		<option value="bs3">BS3</option>
	</field>

Expected results

There is a demo value in the article configuration. Additionally all lists should be searchable and saveable.

image

The following screencast shows a similar setup for DPCalendar.
with-patch

Actual result

On small lists it is not possible to add custom values.

image

The following screencast shows a similar setup for DPCalendar.
without-patch

avatar laoneo laoneo - open - 23 Nov 2016
avatar laoneo laoneo - change - 23 Nov 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Nov 2016
Category Administration com_config
avatar Bakual
Bakual - comment - 23 Nov 2016

Yeah, we just reverted that code lately because we don't want the searchfield for all fields.
See #12855

If you need it for a specific field, load chosen again with different arguments for that selector alone.

avatar Fedik
Fedik - comment - 23 Nov 2016

as @Bakual already wrote, it should be applied only to specific field where need this feature, not to all select on the page, because it make more problem, than actually solves

avatar laoneo
laoneo - comment - 23 Nov 2016

But then you have to tell me how can I do that for the global component options. Because in my setup function of my form field does the following code not change the desired behavior of my field


JHtml::_('formbehavior.chosen', '#jform_frontend_framework', null, array(
'disable_search_threshold' => 0
));

event adding the code to the form field constructor didn't help.

avatar Fedik
Fedik - comment - 23 Nov 2016

very strange
JHtml::_('formbehavior.chosen', '#jform_frontend_framework', null, array( 'disable_search_threshold' => 0 ));
looks correct,

ah, well, the problem that JHtml::_('formbehavior.chosen', 'select'); I guess called on front of your, hard,
another ?

avatar laoneo
laoneo - comment - 23 Nov 2016

There is no way to add it from the form field, you will always be after the general select call.

avatar Bakual
Bakual - comment - 23 Nov 2016

Yep, that's true. It would need to be before the stupid global call.
What we can do is add a call to chosen with a class selector, like a class "nosearchlimit" or something. And then you just add that class to you formfield and it will work.

avatar Fedik
Fedik - comment - 23 Nov 2016

@Bakual also not bad idea
@laoneo in your case, another possible solution is to add custom javascript, to edit/modify existing instance, or destroy existing instance $('#jform_frontend_framework').chosen('destroy') and make new,

but it just a workaround, and not a real fix here

avatar dgt41
dgt41 - comment - 23 Nov 2016
avatar laoneo
laoneo - comment - 24 Nov 2016

It would be so much easier to set the trashhold back to 0. Is there a valid reason not to do? Otherwise every extension dev has always to come to this pr and needs to do the workaround suggested here.

@dgt41 I did that and tried to add a new choosen behavior. The problem is that the categoryedit field is loaded in a category view which loads the chosen behavior with a 0 thrashold https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_content/views/article/tmpl/edit.php#L17 . If this call would be 10 and you have less than 10 categories. It would also not work.

I think for com_config it would be valid to load it with 0 thrashold as every installed component is involved here.

avatar Bakual
Bakual - comment - 24 Nov 2016

It would be so much easier to set the trashhold back to 0. Is there a valid reason not to do?

Yes, because it is ridiculous to have a search field for eg the state or permission list fields. Also it was inconsistent accross the various forms.
I proposed you already a working solution, which then could also applied to the category field cases. Lets go with that instead of adding a search box to every list field.

avatar Fedik
Fedik - comment - 24 Nov 2016

some other reasons:

  • performance (more interaction with DOM), especialy on the config screen where a loot inputs,
  • it useless in fields with 2-4 <option> (@Bakual alredy wrote ? ), that is 95% cases
avatar brianteeman
brianteeman - comment - 4 Dec 2016

Can someone clarify the status of this PR please


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12988.

avatar laoneo
laoneo - comment - 5 Dec 2016

I proposed you already a working solution

Haven't seen one which was working. So the issue still exists as an extension dev can't add a form field which supports new options.

avatar Bakual
Bakual - comment - 5 Dec 2016

Haven't seen one which was working.

My suggestion was instead of your change, do this:

JHtml::_('formbehavior.chosen', '.search-always', null, array('disable_search_threshold' => 0));
JHtml::_('formbehavior.chosen', 'select');

Then add search-always as class in your formfield.
That should work. We just need to settle on a sensible class name.

avatar laoneo
laoneo - comment - 7 Dec 2016

But then I would rather go with

JHtml::_('formbehavior.chosen', '.chzn-custom-value', null, array('disable_search_threshold' => 0));
JHtml::_('formbehavior.chosen', 'select');

as chzn-custom-value is the class you need to add when you want to have custom values.

avatar Bakual
Bakual - comment - 7 Dec 2016

Yeah sure, makes most sense then ?

avatar laoneo
laoneo - comment - 15 Dec 2016

Done.

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 13 Jan 2017

@laoneo is this PR ready to Test?

avatar laoneo
laoneo - comment - 23 Jan 2017

Yes it is

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 24 Jan 2017

I have tested this item successfully on 10b38a5

After PR installed and modefied *.xml theres a searchable list on Articles > Tab Articles called "demo".

After installing PR got Notice: Undefined offset: 1 in __/Joomla/libraries/joomla/form/helper.php on line 363


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12988.

avatar franz-wohlkoenig franz-wohlkoenig - test_item - 24 Jan 2017 - Tested successfully
avatar marrouchi
marrouchi - comment - 13 Feb 2017

I have tested this item successfully on 82bd500


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12988.

avatar marrouchi marrouchi - test_item - 13 Feb 2017 - Tested successfully
avatar Bakual Bakual - change - 13 Feb 2017
Status Pending Ready to Commit
avatar Bakual
Bakual - comment - 13 Feb 2017

Setting to RTC

avatar rdeutz rdeutz - change - 13 Feb 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-02-13 20:32:44
Closed_By rdeutz
Labels Added: ?
avatar rdeutz rdeutz - close - 13 Feb 2017
avatar rdeutz rdeutz - merge - 13 Feb 2017

Add a Comment

Login with GitHub to post a comment