Hi,
I am using the FCKeditor in a content management solution. I save the contents of the editor to a database by by submitting what's inside the editor textarea at that point int time. When serving it back up again, I place the same contents within a named textarea, and then use the oFCKeditor.ReplaceTextarea() command to turn it into the FCKeditor.
The problem is, if the contents contain another textarea tag, it will break. As in, if the editor is being used to edit a HTML page, and that HTML page contains a textarea, then when I serve it back up again, we end up with a textarea tag within the editor's textarea tag, so everything after the end of the textarea will no longer be within the editor.
I am going to try and nut this out now, but my brain isn't working that well lately, so I figured I'd ask here as well.
Thanks in advance for any suggestions.
I am using the FCKeditor in a content management solution. I save the contents of the editor to a database by by submitting what's inside the editor textarea at that point int time. When serving it back up again, I place the same contents within a named textarea, and then use the oFCKeditor.ReplaceTextarea() command to turn it into the FCKeditor.
The problem is, if the contents contain another textarea tag, it will break. As in, if the editor is being used to edit a HTML page, and that HTML page contains a textarea, then when I serve it back up again, we end up with a textarea tag within the editor's textarea tag, so everything after the end of the textarea will no longer be within the editor.
I am going to try and nut this out now, but my brain isn't working that well lately, so I figured I'd ask here as well.
Thanks in advance for any suggestions.
RE: Textarea within textarea problem
A) We were doing things the wrong/stupid way to begin with, and
B) If posting a solution will be worth it of nobody reads this.
But I will post it anyway. The original reason for doing things the way we did was that the easiest way to get previously saved content into the editor as it loads was to just place it between the <textarea> open and close tags while building the page (in Perl/CGI). This required no parsing of the content to replace or escape any characters.
However, as the original post suggests - problems occur if the content contains a <textarea> tag, or in particular, a closing </textarea> tag, since this closes the original <textarea> tag the content was being placed in. Meaning everything after this close tag appears as part of the page below the editor.
So, the solution was to ditch the idea of using the <textarea> to place content in combined with the ReplaceTextarea method, and instead use the Create method of the editor combined with setting the Value property to the saved content. We just had to remove all \n's and \r's, and escape all double quotes. Removing the newlines wasn't a big deal in the end since the editor formats your code anyway.
So, hopefully some day between now and eternity someone will find this useful.