diff --git a/gulliver/js/widgets/suggest/bsn.AutoSuggest_2.1.3.js b/gulliver/js/widgets/suggest/bsn.AutoSuggest_2.1.3.js index 421eb200c..c51746338 100644 --- a/gulliver/js/widgets/suggest/bsn.AutoSuggest_2.1.3.js +++ b/gulliver/js/widgets/suggest/bsn.AutoSuggest_2.1.3.js @@ -471,7 +471,12 @@ _b.AutoSuggest.prototype.setHighlightedValue = function () { if (this.iHigh) { - this.sInp = this.fld.value = this.aSug[ this.iHigh-1 ].value; + /** + * @autor Erik Amaru Ortiz + * This fix when a item on suggestion list have html wntities sent by json like & + */ + this.sInp = this.fld.value = html_entity_decode(this.aSug[ this.iHigh-1 ].value);; + // // move cursor to end of input (safari) // @@ -493,7 +498,7 @@ _b.AutoSuggest.prototype.setHighlightedValue2 = function () { if (this.iHigh) { - this.sInp = this.fld.value = this.aSug[ this.iHigh-1 ].value; + this.sInp = this.fld.value = html_entity_decode(this.aSug[ this.iHigh-1 ].value); // move cursor to end of input (safari) // @@ -772,4 +777,24 @@ function storeEntry(o, cnn, table, pk, pkt, fld){ //alert(req) } ); } -} \ No newline at end of file +} + +function html_entity_decode( string, quote_style ) { + var histogram = {}, symbol = '', tmp_str = '', entity = ''; + tmp_str = string.toString(); + + if (false === (histogram = get_html_translation_table('HTML_ENTITIES', quote_style))) { + return false; + } + + // & must be the last character when decoding! + delete(histogram['&']); + histogram['&'] = '&'; + + for (symbol in histogram) { + entity = histogram[symbol]; + tmp_str = tmp_str.split(entity).join(symbol); + } + + return tmp_str; +} \ No newline at end of file diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 0c2dc5c45..b28d56377 100644 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -1153,7 +1153,7 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek $setValue = ($this->savelabel == '1')? 'obj.value': 'obj.id'; - $sOptions .= 'callback: function(obj){getField(\''.$this->name.'\').value='.$setValue.';'.$sCallBack.'; return false;}'; + $sOptions .= 'callback: function(obj){'.$sCallBack.'; return false;}'; $str .= '