Fix select2 search

This commit is contained in:
Laurent Destailleur
2017-10-28 17:34:46 +02:00
parent adc4db0f85
commit 46f95e14fa
2 changed files with 6 additions and 5 deletions

View File

@@ -5520,12 +5520,13 @@ class Form
'.($callurlonselect ? '
/* Code to execute a GET when we select a value */
$(".'.$htmlname.'").change(function() {
var selected = $(".'.$htmlname.'").select2("val");
$(".'.$htmlname.'").select2("val",""); /* reset visible combo value */
var selected = $(".'.$htmlname.'").val();
console.log("We select "+selected)
$(".'.$htmlname.'").val(""); /* reset visible combo value */
$.each( saveRemoteData, function( key, value ) {
if (key == selected)
{
console.log("Do a redirect into selectArrayAjax to "+value.url)
console.log("selectArrayAjax - Do a redirect to "+value.url)
location.assign(value.url);
}
});

View File

@@ -160,8 +160,8 @@ var select2arrayoflanguage = {
noResults: function () { return "<?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2NotFound")); ?>"; },
inputTooShort: function (input) {
var n = input.minimum;
console.log(input);
console.log(input.minimum);
/*console.log(input);
console.log(input.minimum);*/
if (n > 1) return "<?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2MoreCharacters")); ?>";
else return "<?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2Enter")); ?> " + n + " <?php echo dol_escape_js($langs->transnoentitiesnoconv("Select2MoreCharacter")); ?>"
},