0

I added an editor from this site
http://dhtmlx.com/docs/products/dhtmlxEditor/index.shtml
it works when I add words but when I click submit the text doesn't go through the POST
how do I do this?

I added a textarea like in one of the examples on that site, and another button that when clicked it passes the text from the editor to the textarea and THEN when I hit submit (another button) the text goes through the textarea to my function that handles the POST of the form..
so this is the code for the editor, button and textarea

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
        <div id="editorObj" style="width: 100%; height: 300px; border: #909090 1px solid;" onfocus="document.getElementById('content').value = editor.getContent()"></div>

<script>
	var editor;
	dhtmlx.image_path = "textEditor/dhtmlxEditor/codebase/imgs/";
	function doOnLoad() {
		editor = new dhtmlXEditor("editorObj");
	}
</script>					
         <input type="button" value="show html content" onclick="document.getElementById('content').value = editor.getContent()">
					
	<textarea style="height: 100px;" cols="85" id="content" name="content"></textarea>					
	<input type="submit" name="submit" value="submit" />						
</form>

so of course I don't want to have the 2nd button and I don't really want to have the 2nd textarea, I might change it to a hidden input but still I can't figure out how to pass the data with out clicking the button..I tried to changing the editor by adding this (but it doesn't work)

<div id="editorObj" style="width: 100%; height: 300px; border: #909090 1px solid;" [B]onfocus[/B]="document.getElementById('content').value = editor.getContent()"></div>
<div id="editorObj" style="width: 100%; height: 300px; border: #909090 1px solid;" [B]onchange[/B]="document.getElementById('content').value = editor.getContent()"></div>

Edited by 54uydf: n/a

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by AlexandraKl
0

You may set onsubmit event handler and set editor content as value of form field when the event occurs:

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" onsubmit="setEditorContent()">
...
<script>
   function setEditorContent(){
      document.getElementById('content').value = editor.getContent()
   }
</script>

If you have further questions about dhtmlx components, you can ask them on dhtmlx forum http://forum.dhtmlx.com/viewforum.php?f=1 (the registration is free)

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.