BUG 6913 Suggest fied problem with characteres like #, $ and & is solved
This commit is contained in:
@@ -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 <erik@colosa.com>
|
||||
* 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)
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -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 .= '<script type="text/javascript">';
|
||||
$str .= 'var as_json = new bsn.AutoSuggest(\'form[' . $this->name . ']\', {'.$sOptions.'});';
|
||||
|
||||
@@ -119,6 +119,13 @@
|
||||
{$PME_PRIMARY_KEY_TYPE} {$form.PME_PRIMARY_KEY_TYPE}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class='FormLabel' width="{$form_labelWidth}">{$PME_CALLBACK}</td>
|
||||
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.PME_CALLBACK}</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
{$form.PME_TABLE_DATA}{$form.PME_PRIMARY_KEY_DATA}{$form.PME_PRIMARY_KEY_TYPE_DATA}{$form.PME_FIELD}
|
||||
<td class='FormButton' colspan="2" align="center"> {$form.PME_ACCEPT} {$form.BTN_CANCEL} </td>
|
||||
|
||||
@@ -127,9 +127,9 @@ SELECT XMLNODE_NAME, TYPE FROM dynaForm WHERE XMLNODE_NAME = @@PME_XMLNODE_NAME
|
||||
</en>
|
||||
</PME_PRIMARY_KEY_TYPE>
|
||||
|
||||
<!--<PME_CALLBACK type="textarea" cols="40" rows="2">
|
||||
<en>Javascript routine callback</en>
|
||||
</PME_CALLBACK>-->
|
||||
<PME_CALLBACK type="textarea" cols="40" rows="2">
|
||||
<en>Javascript callback to execute by a selection</en>
|
||||
</PME_CALLBACK>
|
||||
|
||||
<BTN_CANCEL type="button" onclick="cancel();">
|
||||
<en>Cancel</en>
|
||||
|
||||
Reference in New Issue
Block a user