EasyUI Forum

General Category => Bug Report => Topic started by: Stefan B. on February 19, 2014, 01:53:09 AM



Title: HTML tag in messager alert window not parsed correct if Notation in XML used
Post by: Stefan B. on February 19, 2014, 01:53:09 AM
We used the messager like this $.messager.alert("Error", msg, "error");

If we used the message like this all is fine
Code:
"HTTP Status 500 - error executing work<br>Caused by:<br>Objektname"

But if we use the following text with Notation in XML for special characters, the html tags not correct used. The break tag is shown here as text <br> in the alert window.

Code:
"HTTP Status 500 - error executing work&lt;br&gt;Caused by:&lt;br&gt; Objektname"


Title: Re: HTML tag in messager alert window not parsed correct if Notation in XML used
Post by: stworthy on February 19, 2014, 08:17:24 PM
Please try this:
Code:
var msg = 'HTTP Status 500 - error executing work&lt;br&gt;Caused by:&lt;br&gt; Objektname';
msg = msg.replace(/&/g,'<span>&</span>');
$.messager.alert('Error',msg,'error');


Title: Re: HTML tag in messager alert window not parsed correct if Notation in XML used
Post by: Stefan B. on February 20, 2014, 05:54:37 AM
Please try this:
Code:
var msg = 'HTTP Status 500 - error executing work&lt;br&gt;Caused by:&lt;br&gt; Objektname';
msg = msg.replace(/&/g,'<span>&</span>');
$.messager.alert('Error',msg,'error');

No, this is not working. I thing the EasyUi Dialog window should interpate the special HTML Tag notation.

This is working:
Code:
var msg = 'HTTP Status 500<strong> - error executing work&lt;br&gt;Caused by:&lt;br&gt; Objektname';
msg = msg.replace(/&lt;/gi,'<');
msg = msg.replace(/&gt;/gi,'>');
$.messager.alert('Error',msg,'error');

But this is only special for the following characters
&lt; is the char: <
and &gt; is the char: <
and so the String &lt;br&gt; is like <br>

I thing the dialog window should format the message correct for all special characters, while there are many special characters.
See: http://www.w3schools.com/html/html_entities.asp