I'm just implementing the FCKeditor for the first time - nice work! ... but I'm having trouble with my AJAX and I wondered if it was an FCKeditor related problem....
I initially used the the GET method for my xmlHttp.open but I soon discovered this would limit my input in the editor to a tiny 512bytes of text. So I switched to POST
Here's the code:
theEditor=FCKeditorAPI.GetInstance("SJSEditor"); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("POST",url,true); xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=utf-8"); xmlHttp.send("q="+theEditor.GetXHTML());
The trouble is, when I send the data I loose all the spaces in my input.
I am POSTing the data to an ASP page, retrieving it with Request.Form("q") and then sticking it in a database.
I figured it was something to do with the 'urlencoding' which replaces spaces with +s, so I thought I could escape before passing the data like this:
xmlHttp.send("q="+[b]escape[/b](theEditor.GetXHTML()))
Great! This worked. My spaces are returned. However, a new problem:
I can't enter any ascii characters as FCKeditor converts these for me, and then escape converts them again so £ becomes £ and then £ - Obviously this is no use.
So now I am back to trying to discover why I loose all my spaces as it seems better to let FCKeditor do its thing and then fix it rather than trying to second guess!
Any help much appreciated.
Re: Loosing spaces with AJAX POST
Re: Loosing spaces with AJAX POST
Thanks for this... I updated to this:
it works to a certain extent, in that I get my + symbol back, but £ still changes to £ in the WYSiWYG (or £ in source).
Ideally I would prefer to make a standard POST and work out why the spaces go.... i.e. if I use a standard HTML form and method="post" I get expected content with request.form("FCK-instance-name") - why not with AJAX?
Re: Loosing spaces with AJAX POST
Re: Loosing spaces with AJAX POST
I have just run a test submitting the contents of a standard textarea instead of the FCKeditor via AJAX. In this case, too, the input text loses its spaces... continuing to investigate, but any help would be appreciated.
Re: Loosing spaces with AJAX POST
Well, decided to scrap the AJAX POST for the most part and now using an iFrame model and a regular post (Modal Dialogue: http://gabrito.com/files/subModal/ )... now, for some reason, Safari opens the editor in Source Mode.

I'm off to hunt for a solution to this now