Link to home
Start Free TrialLog in
Avatar of quarkmike
quarkmikeFlag for France

asked on

CKEDITOR post into a DIV

Hi,

I  try to post async a CKEDITOR form (ckeditor.com) into a div or CFDIV  (coldfusion)

Here is my code
<form>
<textarea name="editor1">someText</textarea>
<input type="submit">
</form>
		
		



<div name="result" id="result">
</div>

<script src="../ckeditor/ckeditor.js"></script>
<script>
	CKEDITOR.replace( 'editor1',

{
	toolbar: [
		{ name: 'document', items: [ 'Source', '-', 'NewPage', 'Preview','Save'] },	// Defines toolbar group with name (used to create voice label) and items in 3 subgroups.
		[ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ],			// Defines toolbar group without name.
			{ name: 'insert', items: [ 'Image', 'Table', 'HorizontalRule', 'SpecialChar', 'PageBreak', ] },		
																		// Line break - next group will be placed in new line.
		{ name: 'basicstyles', items: [ 'Bold', 'Italic' , 'Underline', 'Strike', 'Subscript', 'Superscript', '-', 'RemoveFormat' ] },
		{ name: 'colors', items: [ 'TextColor', 'BGColor' ] },
		
		
		
	]
});</script>

Open in new window


I try a lot of things but when i change value and post the form nothing change.

Thanks in advance.
Avatar of Scott Fell
Scott Fell
Flag of United States of America image

I don't know CF, but when you are posting the data, remember, ck editor is just making your text area (<textarea name="editor1">someText</textarea>) pretty.

You still have to post the data someplace and then display it.  Either another page, the current page and accept the data via your server side code to a database, variable or cookie.
Avatar of quarkmike

ASKER

The issue is Ckeditor don't act like a classic textarea if i post asynch a classic textarea everything works fine but when i post a ckeditor textarea the data still the same and don't care about the modification i made.
If you are posting async to another page and it works, that means it is working.  If you post normally and you don't see the extra html it creates, then something is wrong with your code that receives the data.  

To test, please create a page with a text area without ckeditor and post the data to the same page.  Make sure you have your cold fusion page set up to accept the post.  If that does not work, you know it is your own code.  If it does work, add back the code for ckeditor.  Just use the basic for now like
CKEDITOR.replace( 'editor1', {
    toolbar: 'Basic'
});

Open in new window

Now, submit again and what happens?  Select a work and make it bold and submit.  Do you see the extra code wrapped in strong or b?
If i post normally (not async) everything works fine or don't work only if i post it async to a div. Using coldfusion.ajaxsubmit, or coldfusion.navigate or jquery.
You can use jquery to post the async.  http://api.jquery.com/jQuery.post/  Look at the example $.post( "test.php", $( "#testform" ).serialize() );

That will post to the page test.php using the form with the id testform.
ASKER CERTIFIED SOLUTION
Avatar of Coast Line
Coast Line
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I can use a div don't need a cfdiv if there is a solution to save data in file or dbase.