Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by GB on Dec 08, 2009 23:13
open dhtmlx forum
How do I pass content from editor to form?

Very basic question but can't find it in the documentation. How do I pass the content from the editor into a form? Is it just like a regular textbox, and if so, which is the field (or id) for the name?

Thanks.
Answer posted by Alex (support) on Dec 09, 2009 02:21

Do you mean dhtmlxEditor component ? 

If you do, try to use the getContent() method:

var content = editor.getContent();

http://www.dhtmlx.com/docs/products/dhtmlxEditor/samples/01_initialization/01_editor_content.html

Answer posted by gb on Dec 09, 2009 06:30

Thats right - the dhtmlxeditor component.      In the example where you put the content down to the other textbox - I need to put that same content into a simple form - still don't see how to do that.

This doesn't work (when I'm tryiing to get a form element named "res"):

<form action=http://www.whatever......  METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">
 
 
<div id="editorObj" style="width: 100%; height: 300px; border: #909090 1px solid;"></div>
<input type="button" value="show html content" onclick="document.getElementById('res').value = editor.getContent()">

<script>var editor = new dhtmlXEditor("editorObj");
editor.setIconsPath("../../codebase/imgs/");
editor.init();</script>

</form>

 

Answer posted by Alex (support) on Dec 09, 2009 07:04
You can place the content into some hidden fields of the form.
Answer posted by gb on Dec 09, 2009 09:17

That worked.   Thanks.

One more thing - the only skin that I can get to work is 'sky-blue', like the example.     Is there any reason black or 'standard' doesn't work?

Answer posted by Alex (support) on Dec 10, 2009 02:12

standard skin isn't supported in 2.5 version

The sample for editor skins - dhtmlxEditor/samples/01_initialization/04_editor_skinning.html ( http://www.dhtmlx.com/docs/products/dhtmlxEditor/samples/01_initialization/04_editor_skinning.html ).