Mental Note No. 4974: Use XMLFormat() when doing Ajax

Posted At : February 1, 2007 9:13 AM | Posted By : Mark Drew
Related Categories: coldfusion, doh!

There is an application I built using some Spry related drop downs. It has been working for months (since the summer really) fine and all of the sudden the drop down boxes disappeared. Without going too much into what it does, its basically a page list and it stopped working.

After a lot of checking config and what have you, it basically come down to Internet Explorer chocking on the page names, even though they were in a CDATA block it still didn't like them.

To cut a long story (of debugging, using a lot of profanity and most of the characters above the numbers on a keyboard) short, if you are not in control of what is going to be in your XML, add XMLFormat() to your output

<pagelist>
... loop...
<page>
<id>#id#</id>
<pagename><![CDATA[#XMLFormat(pagename)#]]></pagename>
</page>


</pagelist>

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Ben Nadel's Gravatar Mark,

Interesting tip! I am curious what version of IE you are using. I never thought of doing that. I just assumed that CDATA would take care of all that business. I guess I should go update my RSS feed.
# Posted By Ben Nadel | 2/1/07 1:42 PM
Mark Drew's Gravatar It was failing on IE6 and IE7 ... go figure!

I couldn't spot which character it was, since when I tried to view source in IE, it just cried and sulked in a corner
# Posted By Mark Drew | 2/1/07 1:48 PM
Ben Nadel's Gravatar Sometimes IE just needs a "Time out" in the corner while the more mature browsers continue on with their fun and games.
# Posted By Ben Nadel | 2/1/07 1:51 PM