Rank: Member Groups: Member
Joined: 4/1/2010 Posts: 18
|
I've got this problem while trying to write unusual input on a TextBoxColumn of a Grid. My test machine was equipped with Internet Explorer 8.0.7600.16385 It seems that if you write any html encoded character, when you exit from edit mode, the cell represents the text decoded. So you have big troubles with any &, it simply disappears, and any recognized encoding like < or similar - it gets decoded in <. Maybe I'm wrong, but I'd simply like to see exactly what I wrote in the input box...am I? To be clear I recorded a test session showing what I mean, using the demo page at: http://demo.essentialobjects.com/Demos/Grid/Features/Edit%20Grid%20Data%20-%20Excel%20Style/Demo.aspxthis is the video: http://www.youtube.com/watch?v=1Tn0oIm4rr8Let me know, thank you. Diego
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, We are not sure whether we should encode it or not. The Grid does NOT encode any HTML for static cells and that is done on purpose so that you will be able to put any raw HTML inside a Grid cell to render contents such as image, button, etc. We would like to have the textbox column to be consistent in that manner as well. This is not a problem at all for most people because they would not enter HTML in the Grid. However in case you must enter HTML, you may consider using a CustomColumn: http://doc.essentialobjects.com/library/1/grid/custom_column.aspxCustomColumn can do everything a TextBoxColumn can do except for that it does not automatically resizes the editing UI (because it may not be textbox) when the column resize. We have a new build that supports ClientSideOnColumnResize event which you can handle with JavaScript to automatically resize your textbox. We will PM you the download location of the new build. Thanks!
|
Rank: Member Groups: Member
Joined: 4/1/2010 Posts: 18
|
Yes I understand your point, I'm just a bit concerned because after all a simple user when filling a field defined as textboxcolumn maybe expects to see just what he wrote inside. I mean that if the cell value contains a text, that same text may have a different meaning when passed to the "presentation layer". And that's just a coincidence, I mean the coupling between actual data and "markers" to describe the presentation form. The developer decides the style, and the developer wants the text -just text- to be displayed as he decides. It's even dangerous not to escape html special characters, it may represent a sort of unexpected behaviour for the developer point of view. the user when filling that field may decide to write an entire html page inside! that would be a malicious way of acting, but even innocent intentions may result bad. If the user just wants to insert characters like < or &, they just don't get displayed -I'm talking about IE8. If this is the default behaviour a TextBoxColumn becomes something you can't rely on. I cannot even imagine a scenario where this could be adopted safely. I'd always need to use a CustomColumn.
-edit: There's something I didn't say before, it's called TEXTboxcolumn not HTMLboxcolumn so if I insert "<b>" I want to see "<b>" I don't want to see the following text changing style and become bold. That's just to explain why I truly believe this to be not the correct behaviour. Maybe I'm wrong, but I don't really like when different domains mix and become impossible to control or predict.
-edit2: I read better your reply, you say: in case you must enter HTML, you may consider using a CustomColumn.
For me the problem is: 1) I don't want the user to be able to screw up the layout deciding to fill the grid with malicious data. 2) I don't want the innocent user to think the system doesn't work because he cannot see something he actually typed for legit reasons -like & or < for example. 3) I want the user to see always what he wrote inside the inputbox as text using the style I decided in advance.
I think you are right when you decide to allow html content on a readonly field, but it's extremely questionable on an editable text field -on my opinion of course.
Anyway I know how to use a CustomColumn to achieve what I want and I'll solve that way, I just talked here about it because I was sure the topic deserved attention. Buy maybe it would be complicated to change things now because it would break "compatibility" and people used to the previous behaviour would be upset about it. Just my 2 cents.
Thank you for your reply, Diego.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Yes. You have brought up several very good points and I certainly think this topic deserves attention. However you also see clearly that there is a "compatibility" issues here. We maybe able to add something like "AutoTrimHtml" or "AutoEscapeHtml" property on the TextBoxColumn and have them default as false. In that case there will be no behavior changes for our existing customers but concerned users can set those properties to true.
Thanks!
|