htmlArea

A directory of browser-based WYSIWYG editors

  MAIN
INDEX
SEARCH
POSTS
WHO'S
ONLINE
LOG
IN

Home: htmlArea 3 (beta): htmlArea 2 & 3 archive (read only): htmlArea v3.0 - Discussion:
Passing post data


The htmlArea 2 & 3 editors have been discontinued.

We've made these forums available as a read-only reference and knowledge-base for people using or developing editors based on htmlArea 2 or 3.

Anyone who is interested in taking over version 2 or 3 is free to do so. All we ask is that you choose a new name that doesn't have "htmlarea" in it to avoid confusion with this site. We'll even give you a link in the directory to make it easier for people to find you. If you are developing or hosting an htmlArea based-editor under a new name, please submit it to our directory.

 


amrigo
Novice

Jan 19, 2005, 9:57 AM

Post #1 of 9 (4350 views)
Shortcut
Passing post data Can't Post

Hi

How can i pass data from a form using the post method to another file ? i try using editor.getHTML():

function saveData() {

parent.content.document.frm.target = "control";
parent.content.document.frm.action = "../content/link_save.php?f_txt_description="+editor.getHTML();
parent.content.document.frm.submit();

}

I just can not update my database record using a textarea with htmlarea because the textarea value is not going to this second file!

What can be wrong?

Thank´s in advance


(This post was edited by amrigo on Jan 19, 2005, 10:04 AM)


amrigo
Novice

Jan 19, 2005, 10:20 AM

Post #2 of 9 (4338 views)
Shortcut
Re: [amrigo] Passing post data [In reply to] Can't Post

Well i just ad a line that solve this problem:

function saveData() {

parent.content.document.frm.target = "control";
parent.content.document.frm.f_txt_description.value = editor.getHTML()
parent.content.document.frm.action = "../content/link_save.php?f_txt_description="+editor.getHTML();
parent.content.document.frm.submit();

}


I would like to know how can i handle it if i have more than one variable to be posted can i use get Html() function passing inside the id of the especific field i need:

parent.content.document.frm.f_txt_description.value = editor.getHTML(f_txt_description)
parent.content.document.frm.f_txt_newdescription.value = editor.getHTML(f_txt_newdescription)



sleemanj
User

Jan 19, 2005, 10:48 PM

Post #3 of 9 (4324 views)
Shortcut
Re: [amrigo] Passing post data [In reply to] Can't Post

getHTML is a method of the editor object, it does not take an editor object, and each editor object only handles one textarea.

Please post the code you are using to generate the multiple editors, I suspect it is faulty.


James Sleeman
PHP Programmer


amrigo
Novice

Jan 20, 2005, 5:59 AM

Post #4 of 9 (4318 views)
Shortcut
Re: [sleemanj] Passing post data [In reply to] Can't Post

Hi

I generate this code following the 2-areas.html example, i do get a editor1 is not an object error message: i really do not see what can it be the problem, thank´s in advance for any tip.

<html>
<head>
<title> New Document </title>
<script type="text/javascript">

_editor_url = "../inc/htmlarea/";
_editor_lang = "en";

</script>

<script type="text/javascript" src="../inc/htmlarea/htmlarea.js"></script>
<script type="text/javascript" src="../inc/htmlarea/htmlarea_css.js"></script>

<script language="JavaScript">
<!--
function initEditor() {

var editor_conf1 = new HTMLArea.Config();
editor_conf1.toolbar = [ [ "bold", "italic", "underline"] ]

var editor1 = new HTMLArea("f_txt_description", editor_conf1);
editor1.generate();

var editor_conf2 = new HTMLArea.Config();
editor_conf2.toolbar = [ [ "bold", "italic", "underline" ] ]
var editor2 = new HTMLArea("f_txt_text",editor_conf2);
setTimeout(function() {
editor2.generate();
}, 500);

};

function save() {
parent.content.document.frm.target = "control";
parent.content.document.frm.f_txt_description.value = editor1.getHTML();
parent.content.document.frm.f_txt_text.value = editor2.getHTML();
parent.content.document.frm.action = "save.php";
parent.content.document.frm.submit();
}
//-->
</script>
</head>

<body onload="initEditor()">

<form method=post action="save.php" name="frm">
Description: <textarea name="f_txt_description" rows="6" cols="6"></textarea>
<br>
Text: <textarea name="f_txt_text" rows="6" cols="6"></textarea>
<br>
<input type="submit">
</form>

</body>
</html>


sleemanj
User

Jan 20, 2005, 9:49 AM

Post #5 of 9 (4295 views)
Shortcut
Re: [amrigo] Passing post data [In reply to] Can't Post

You have a variable scope problem, replace your initEditor with.


Code
editor1 = null; 
editor2 = null;
function initEditor() {

var editor_conf1 = new HTMLArea.Config();
editor_conf1.toolbar = [ [ "bold", "italic", "underline"] ]

editor1 = new HTMLArea("f_txt_description", editor_conf1);
editor1.generate();

var editor_conf2 = new HTMLArea.Config();
editor_conf2.toolbar = [ [ "bold", "italic", "underline" ] ]
editor2 = new HTMLArea("f_txt_text",editor_conf2);
setTimeout(function() {
editor2.generate();
}, 500);

};



James Sleeman
PHP Programmer


acscherp
Novice

Jan 21, 2005, 1:17 AM

Post #6 of 9 (4269 views)
Shortcut
Post data in firefox [In reply to] Can't Post

I have about the same problem: in Firefox, the content does not get posted, but in IE it does. This is my htmlarea code:


Code
<SCRIPT language="JavaScript" event="onload" for="window" defer="1" > 
var editor_content = new HTMLArea('comment_content_');editor_content.registerPlugin(ContextMenu);
editor_content.registerPlugin(FullScreen);
editor_content.config.pageStyle = "@import url(htmlarea/custom.css);"; editor_content.config.toolbar = [
[ "copy", "cut", "paste", "separator", "undo", "redo", "separator",
"bold", "italic", "underline", "separator", "strikethrough", "subscript", "superscript", "separator",
"justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
"insertorderedlist", "insertunorderedlist", "outdent", "indent"],

[ "linebreak", "formatblock", "separator",
"forecolor", "hilitecolor", "createlink", "fullscreen" ]
];editor_content.config.width = "570";editor_content.config.height = "180";editor_content.config.killWordOnPaste = true;editor_content.config.statusBar = false;setTimeout(function() { editor_content.generate();}, 200);
</script>


And the following htmlarea definition:


Code
<TEXTAREA id="comment_content_" cols="40" rows="10" name="comment[content]"></TEXTAREA>


hints anyone?


sleemanj
User

Jan 21, 2005, 6:36 AM

Post #7 of 9 (4250 views)
Shortcut
Re: [acscherp] Post data in firefox [In reply to] Can't Post

Does the bug persist if you make the id and name fields the same?


James Sleeman
PHP Programmer


tholdy
Novice

Jan 21, 2005, 12:18 PM

Post #8 of 9 (4228 views)
Shortcut
Re: [sleemanj] Post data in firefox [In reply to] Can't Post

I had the exact same problem .. but then I changed to "Textmode" right before submitting. Then it worked. I also tried to type some text, go "textmode" and then "wysiwyg-mode", write more text and submit. Then only the text from before i changed to "Textmode" was sent.


acscherp
Novice

Jan 25, 2005, 2:53 AM

Post #9 of 9 (4114 views)
Shortcut
Re: [sleemanj] Post data in firefox [In reply to] Can't Post

Yeah, even when the ID and name fields are the same, the bug persists... in IE it works, however. Anychance onsubmit() gets not called?




Code
<TEXTAREA id="message" name="message" style="width: 100%"></TEXTAREA>



Code
<SCRIPT language="JavaScript" event="onload" for="window" defer="1" > 
var editor_content = new HTMLArea('message');editor_content.registerPlugin(ContextMenu);
editor_content.registerPlugin(FullScreen);
editor_content.registerPlugin(CleanHTML);
editor_content.config.pageStyle = "@import url(htmlarea/custom.css);"; editor_content.config.toolbar = [
[ "copy", "cut", "paste", "separator", "undo", "redo", "separator",
"bold", "italic", "underline", "separator", "strikethrough", "subscript", "superscript", "separator",
"justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
"insertorderedlist", "insertunorderedlist", "outdent", "indent"],

[ "linebreak", "formatblock", "separator",
"forecolor", "hilitecolor", "createlink", "separator", "cleanhtml", "fullscreen" ]
];editor_content.config.width = "auto";editor_content.config.height = "200";editor_content.config.killWordOnPaste = true;editor_content.config.statusBar = false;setTimeout(function() { editor_content.generate();}, 200);
</script>


 
 
 


Search for (options)