Fix search when using special char

This commit is contained in:
Laurent Destailleur 2018-05-13 12:42:16 +02:00
parent 53b5733fb4
commit 302d9399e2

View File

@ -5542,7 +5542,7 @@ class Form
/** /**
* Return a HTML select string, built from an array of key+value but content returned into select come from an Ajax call of an URL. * Return a HTML select string, built from an array of key+value, but content returned into select come from an Ajax call of an URL.
* Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice. * Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice.
* *
* @param string $htmlname Name of html select area * @param string $htmlname Name of html select area
@ -5557,7 +5557,7 @@ class Form
* @param string $placeholder String to use as placeholder * @param string $placeholder String to use as placeholder
* @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return string HTML select string * @return string HTML select string
* @see ajax_combobox in ajax.lib.php * @see selectArrayFilter, ajax_combobox in ajax.lib.php
*/ */
static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0) static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
{ {
@ -5618,7 +5618,7 @@ class Form
/* Code to execute a GET when we select a value */ /* Code to execute a GET when we select a value */
$(".'.$htmlname.'").change(function() { $(".'.$htmlname.'").change(function() {
var selected = $(".'.$htmlname.'").val(); var selected = $(".'.$htmlname.'").val();
console.log("We select "+selected) console.log("We select in selectArrayAjax the entry "+selected)
$(".'.$htmlname.'").val(""); /* reset visible combo value */ $(".'.$htmlname.'").val(""); /* reset visible combo value */
$.each( saveRemoteData, function( key, value ) { $.each( saveRemoteData, function( key, value ) {
if (key == selected) if (key == selected)
@ -5644,7 +5644,7 @@ class Form
} }
/** /**
* Return a HTML select string, built from an array of key+value but content returned into select come from an Ajax call of an URL. * Return a HTML select string, built from an array of key+value, but content returned into select is defined into $array parameter.
* Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice. * Note: Do not apply langs->trans function on returned content of Ajax service, content may be entity encoded twice.
* *
* @param string $htmlname Name of html select area * @param string $htmlname Name of html select area
@ -5659,7 +5659,7 @@ class Form
* @param string $placeholder String to use as placeholder * @param string $placeholder String to use as placeholder
* @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect)
* @return string HTML select string * @return string HTML select string
* @see ajax_combobox in ajax.lib.php * @see selectArrayAjax, ajax_combobox in ajax.lib.php
*/ */
static function selectArrayFilter($htmlname, $array, $id='', $moreparam='', $disableFiltering=0, $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0) static function selectArrayFilter($htmlname, $array, $id='', $moreparam='', $disableFiltering=0, $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0)
{ {
@ -5708,8 +5708,9 @@ class Form
var urlBase = data.url; var urlBase = data.url;
var separ = urlBase.indexOf("?") >= 0 ? "&" : "?"; var separ = urlBase.indexOf("?") >= 0 ? "&" : "?";
/* console.log("params.term="+params.term); */
saveRemoteData[data.id].url = urlBase + separ + "sall=" + params.term;'; /* console.log("params.term encoded="+encodeURIComponent(params.term)); */
saveRemoteData[data.id].url = urlBase + separ + "sall=" + encodeURIComponent(params.term);';
} }
if(! $disableFiltering) { if(! $disableFiltering) {