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

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
Augustas
Forum Members
Forum Members
Posts: 241
Joined: Wed Oct 17, 2007 6:09 pm
Location: the world

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

Post 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
Last edited by Augustas on Tue Oct 30, 2007 1:50 pm, edited 1 time in total.
http://FollowTheRoad.com/ - living on the road...
http://www.kligys.com/ - asmeninis blog'as...
User avatar
Augustas
Forum Members
Forum Members
Posts: 241
Joined: Wed Oct 17, 2007 6:09 pm
Location: the world

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

Post 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.
http://FollowTheRoad.com/ - living on the road...
http://www.kligys.com/ - asmeninis blog'as...
Post Reply

Return to “Developers Discussion”