Autocomplete Field Search entiry string,

  • hyperx
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 9 months ago #2185 by hyperx
Hello,

currently the Autocompletion Field works only as an autocompletion on the first letter so if you start with a S, all Tags starting with a S are shown.

So lets say i have a tag "See Example" it will show up when i start to type "see", however i would also like for it to show up when i start to type "example"

Is it possible to change this in th JS File and if so where?

To adjust the minLength, so the autocomplete funtion doesn't start after the first letter is probably easily changed by changing the number on Line 26 or not?

Please Log in or Create an account to join the conversation.

More
9 years 9 months ago #2186 by andrea_4g
Replied by andrea_4g on topic Autocomplete Field Search entiry string,
== minLength ==
You can change the minLength value by editing:
modules/mod_cpsearch/helper.php
and change lines 428-430 from
Code:
jQuery(document).ready(function (){ jQuery( "#ac_'.$fId.'" ).autocomplete({ source: function(request, response) { ...
to:
Code:
jQuery(document).ready(function (){ jQuery( "#ac_'.$fId.'" ).autocomplete({ minLength: 2, source: function(request, response) { ...

You can also do that without altering the module non-overridable code by adding the following js script to your page:
Code:
jQuery(document).ready(function (){ jQuery( "#ac_cp_field_96_1" ).autocomplete("option", "minLength", 2); });
where ac_cp_field_96_1 is the id of your autocomplete field and 2 is the number of chars to be typed.

== search in the middle ==
You have to alter Custom Properties core code (and that will leave you with a custom version of CP that will be overwritten upon future upgrades, and so on and so forth ...)

Edit file components/com_customproperties/controller.php
Change line 224 from:
Code:
"AND v.label LIKE '$value%' " .
to
Code:
"AND v.label LIKE '%$value%' " .
The following user(s) said Thank You: hyperx

Please Log in or Create an account to join the conversation.

Time to create page: 0.150 seconds