PDA

View Full Version : [OPEN-1028] HtmlEncode bug in DisplayField



Yazla
4 Jun 2010, 8:26 AM
Ext version tested:

Ext 3.2


Adapter used:

ext


css used:

only default ext-all.css




Browser versions tested against:

IE8
FF3 (firebug 1.3.0.10 installed)


Operating System:

Windows 7


Description:

Text with special symbols (&, " etc) not renders correctly i "displayfield", despite the fact that htmlEncode property is set to true.


Test Case:



var w = new Ext.Window({
width: 200
, items:[
{
xtype: 'displayfield'
, fieldLabel: 'Title'
, htmlEncode: true
, ref: 'titlefield'
, anchor: '100%'
}]
});

w.titlefield.setValue("foo&bar");

w.show();


See this URL : http://


Steps to reproduce the problem:

run code above.


The result that was expected:

label text should be "foo&bar"


The result that occurs instead:

label text is "foo&bar"


Possible fix:

[Ext.form.DisplayField.override({
setRawValue: function(v) {
var value = v;
if (this.htmlEncode) {
v = Ext.util.Format.htmlEncode(v);
}
return this.rendered ? (this.el.dom.innerHTML = (Ext.isEmpty(v) ? '' : v)) : (this.value = value);
}
});



Cheers.

evant
4 Jun 2010, 5:45 PM
Please follow the bug guidelines: http://www.extjs.com/forum/showthread.php?71015-Posting-to-the-Bug-Forum

Specifically:
a) What version are you using
b) What happens
c) What do you expect to happen.

When I run the code, I get a window that contains "foo&bar"