Page 1 of 1

[solved] Xajax: "You have whitespace in your response"

Posted: Fri Oct 26, 2007 4:26 pm
by Augustas
Hello,

My module creates a new Content Type in "Pages" menu. I am writing module by combining code from "Skeleton" and "Jobs" modules, so there are no advanced coding yet. Everything is kind of a copy-paste.

Unfortunately whenever I create a new Content Type with MyType - "Reorder Pages", "Move" up/down arrows, "Expand/Collaps Sections", also "Delete" icon STOP WORKING. Seems there is a problem with xajax. (When I create content of type "Jobs" from which I copied the code, there is NO Problem).

I figured out that it probably does not work, because the XML that is spitted by xajax has leading spaces.

Here is the xajax response, when DELETING by clicking on the trash-icon (and I get the same error with other xajax calls on "Pages" admin-page)

[glow=beige,2,300]Case 1[/glow] - Works GOOD - when "Pages" do not contain MyType of content:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?><xjx><cmd n="js"><![CDATA[new Effect.Fade('tr_52', { afterFinish
:function() { xajax_content_list_ajax(); } });]]></cmd></xjx>

[glow=beige,2,300]Case 2[/glow] - DOES NOT WORK - when "Pages" contain entry with MyType of content.

Code: Select all

        <?xml version="1.0" encoding="utf-8" ?><xjx><cmd n="js"><![CDATA[new Effect.Fade('tr_57', { afterFinish
:function() { xajax_content_list_ajax(); } });]]></cmd></xjx>
[glow=beige,2,300]As you see - there is a "        " space before "<?xml".[/glow]

Plus, OPERA together with this response brings these messages:

Before XML output - "Error: the XML response that was returned from the server is invalid."
After the XML - "You have whitespace in your response."

I did not manage to figure out why having content of MyType in "Pages" affects the output of xajax.

Anyone has similar problems or know the solution?

Would appreciate any help.
Thanks.

P.S. I think it would be also good to update XAJAX package in CMSMS distribution from version 0.2.4 to the newest - v. 0.5

Re: Xajax: "You have whitespace in your response"

Posted: Tue Oct 30, 2007 1:50 pm
by Augustas
Sorry, I have just found a silly mistake of mine.
Somehow the file contenttype.MyType.php got a tab in front of the first "<?php".

Code: Select all

    <?php
and this caused all the problem.