Hi, I'm new to this forum.
I've just installed CKEditor in a site, and this is how I'm setting it up:
<head> ... <script type="text/javascript" src="path/to/ckeditor/ckeditor.js"></script> </head> <body> ... <textarea name="content" id="content"><?= $result['content'] ?></textarea> <script type="text/javascript"> CKEDITOR.replace( 'content' , { toolbar: [ { name: 'basicstyles', items : [ 'Bold','Italic','Strike','-','RemoveFormat' ] }, { name: 'clipboard', items : [ 'Cut','Copy','Paste','-','Undo','Redo' ]}, { name: 'align', items : [ 'JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ]}, { name: 'styles', items : [ 'Format' ] }, { name: 'paragraph', items : [ 'NumberedList','BulletedList' ] } ] } ); </script> ... </body>
Re: Content of editor is not sent
do you have <form method="post" ... tag in your script ?
Please try replacebyclass.html or other sample in "_samples" directory. In sample there is a form so you can use it as example.
Re: Content of editor is not sent
Yes, the form is set to send data through POST. In fact every other data in the form is actually sent. I checked it out with Firebug.
I think it's not just the editor, but some Javascript conflict, with JQuery I guess, because I'm also using the editor in the backend with even more tools, getting an excellent result. There is no jQuery code here. However I'm using jQuery in the page in which CKEditor is not working, with jQuery.noConflict() and "jQuery" instead of the variable name "$" to minimize possible conflicts.
I've had little time to keep going, and had to temoprarily restore to the plain textarea so that the users could send data through it, but I will try disabling jQuery tomorrow and tell you the results.
Regards,
Luis.
Re: Content of editor is not sent
Hello again Michal,
I think I found the reason why it is not working as expected, but I'm not sure what to do in this case. It is not due to any JS conflict. First of all I've had to comment out the editor code so that the users can send data without any problem. But you will see it in the source code just below the textarea definition. This is the page:
http://www.clasificadosok.com/agregar-anuncio.html
The page initially uses three different forms to send the data:
1- One for the text data of a new advertisement
2- Another one to store the image files
3- The last one to sign up as a new user at the same time.
This was implemented this way, using three forms, by another person. Personally I would have used a unique form. Also there is a validation script. You can check function Agregar() which is the one which picks up the data from every form, validates it and sends it.
After some JS debugging with Firebug, I've checked that first of all this function Agregar() picks up all the data from the different forms and stores them in hidden fields of the form which will be sent. It finally sends all the data through POST.
So, the delivered form is not the one with the textarea, but another one that reads the textarea value, whose field name is "contenido" (I used "content" instead in the previous example for clarity). At this time of execution, the textarea has not received the value from the editor yet.
So, if you could tell me an easy way around to this which doesn't imply much code modifying, I would greatly appreciate it. For instance, could I execute the editor's code before the forementioned function Agregar(), thus having the end data of the textarea ready for this function?
Regards,
Luis.
Re: Content of editor is not sent
It sounds that you have to 'play' with Javascript.
I think you should try use CKEditor api function like http://docs.cksource.com/ckeditor_api/s ... ml#getData and check what you get when you call this function in your validation methods.
Please check CKEditor api documentation for other methods than can help you.
EDIT:
I removed second function suggested by me , because it is not correct in this case.
Re: Content of editor is not sent
Hello,
I tried with the first function getData() and it worked! *thumbs up*
Thanks for your help!