Why is content hidden if wrapped in HTML/XML markup?
Why is content hidden if wrapped in HTML/XML markup?
I'm using DT and Editor.
I was testing to see if special characters like </>
will break my application. If I include markup while editing a row, like this <stuff>THING</stuff>
, "THING" is always displayed, but </stuff>
is missing in the DataTable view. However, everything IS displayed while editing (see screenshot), either in Inline or Full Row edit modes. Our preference is to display all characters, to include </stuff>
. I should note that the entire string IS sent and recorded into the database. It doesn't matter if it's an inline edit, or a full row edit.
Here's what's captured, and sent to the SQL server for processing:
{
"DT_RowId": "79ED6880-0148-E811-8102-5CB9019B7A40",
"PosTitle": "Administrative Assistant I <stuff>HIDDEN?</stuff>",
}
Here's what SQL server sends back (error and fieldErrors are automatically added by Editor):
{
"data": [
{
"DT_RowId": "79ED6880-0148-E811-8102-5CB9019B7A40",
"PosTitle": "Administrative Assistant <stuff>HIDDEN?</stuff>",
}
],
"error": "",
"fieldErrors": []
}
This question has an accepted answers - jump to answer
Answers
Can you show me your server-side code please?
Allan
@allan Sure... I've tried to simplify this as pseudo-code to make it concise as possible. I've omitted columns, and I've tried to put it in order. I hope it makes sense.
I guess the main thing to consider is that our framework deals mainly in XML. I've had success with wrapping JSON strings inside XML like a burrito, and it's worked so far. If I look at what's being passed back-and-forth between SQL & JS, the JSON string fully maintains this entire character string:
<stuff>HIDDEN?</stuff>
. What I mean is: I feel confident that the JSON string is being maintained inside of the XML. I've even tried usingFOR XML EXPLICIT
andCDATA
, but that didn't seem to make a difference.SQL SERVER PROCESSING
JS APP
Thanks! I think I'm with you now.
DataTables doesn't escape HTML entities by default when drawing the data to a cell. You can have it do that using the text renderer that is built in which it sounds like what you need in this instance.
Allan