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:
how to get back the content from HTMLArea ?


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.

 


antony_csf
New User

Jan 20, 2005, 7:05 PM

Post #1 of 9 (4220 views)
Shortcut
how to get back the content from HTMLArea ? Can't Post

hi all, I am using php with postNuke system.

I have a problem on get back the HTMLArea edited content.

I try to use javascript alert('') to print out the content, however it show me the old content !!

any person can give me some idea or suggest ??Frown


acscherp
Novice

Jan 21, 2005, 4:14 AM

Post #2 of 9 (4192 views)
Shortcut
Re: [antony_csf] how to get back the content from HTMLArea ? [In reply to] Can't Post

Can you show the javascript code for the HTMLarea? I am having the same problem at the moment (with the htmlarea fork).


amrigo
Novice

Jan 21, 2005, 9:44 AM

Post #3 of 9 (4178 views)
Shortcut
Re: [acscherp] how to get back the content from HTMLArea ? [In reply to] Can't Post

I get the textarea value using getHTML():


Code
parent.content.document.myframe.myfield.value = editor.getHTML();



antony_csf
New User

Jan 24, 2005, 10:22 PM

Post #4 of 9 (4091 views)
Shortcut
Re: [amrigo] how to get back the content from HTMLArea ? [In reply to] Can't Post

It there any method can use to save the content in the textarea??

such editor.save();

I still cannot print out the edited content!! please give some idea or suggestion!!FrownFrown

thx !!




amrigo
Novice

Jan 25, 2005, 2:44 AM

Post #5 of 9 (4078 views)
Shortcut
Re: [antony_csf] how to get back the content from HTMLArea ? [In reply to] Can't Post

I wrote this function, passing the editor.getHTML value to the fields i have in my form, and is it working for me:

function save() {
parent.content.document.frm.target = "control";
parent.content.document.Myframe.MyField.value = editor.getHTML();
parent.content.document.Myframe.MyField1.value = editor1.getHTML();
parent.content.document.Myframe.action = "salve.php";
parent.content.document.frm.submit();
}
<a href="javascript:save()">SUBMIT DATA TO THE DATABASE</a>
Hope this help!


mzoroz
New User

Jan 26, 2005, 9:04 AM

Post #6 of 9 (4031 views)
Shortcut
Re: [amrigo] how to get back the content from HTMLArea ? [In reply to] Can't Post

Hi I tried your example. Didnt work Can you post an example. Thanks


amrigo
Novice

Jan 26, 2005, 10:37 AM

Post #7 of 9 (4022 views)
Shortcut
Re: [mzoroz] how to get back the content from HTMLArea ? [In reply to] Can't Post

I do exactly what you read in the post and work for me may you can post your code so i can look what is happening?!


antony_csf
New User

Jan 26, 2005, 11:18 PM

Post #8 of 9 (3997 views)
Shortcut
Re: [amrigo] how to get back the content from HTMLArea ? [In reply to] Can't Post

function onlineide_admin_editFile($args){
$backURL = pnModURL('onlineide', 'admin', 'activityNew');
$saveURL = pnModURL('onlineide', 'admin', 'saveFile');

$output->TextHTML("<SCRIPT LANGUAGE=\"JavaScript\" src=\"modules/onlineide/pnjavascript/materialManagement.js\"></SCRIPT>\n");

// check default load HTMLArea plugin
if($pos !== false){
$output->TextHTML("<script type=\"text/javascript\">
_editor_url = \"". pnGetBaseURL() . _OICHTMLAREA . "\";
_editor_lang = \"en\";
</script>\n");

$output->TextHTML("<script type=\"text/javascript\" src=\"". pnGetBaseURL() . _OICHTMLAREA . "htmlarea.js\"></script>\n");

$output->TextHTML("<script type=\"text/javascript\" defer=\"1\">
HTMLArea.replaceAll();
</script>");

$output->TextHTML("<input type=\"button\" value=\"init\" onclick=\"initDocument()\">\n");
}

$output->TextHTML("Edit File Content\n");
$output->TextHTML("<form name=\"addActivity\" action=\"$backURL\" method=\"post\">\n");
$output->TextHTML("<input type=\"hidden\" name=\"activityID\" value=\"$activityID\">\n");
$output->TextHTML("<input type=\"hidden\" name=\"orderID\" value=\"$orderID\">\n");
$output->TextHTML("<input type=\"hidden\" name=\"atpName\" value=\"$atpName\">\n");
$output->TextHTML("<input type=\"hidden\" name=\"mainClassName\" value=\"$mainClassName\">\n");
$output->TextHTML("<input type=\"hidden\" name=\"activityDescription\" value=\"$activityDescription\">\n");
$output->TextHTML("<input type=\"hidden\" name=\"activityDirectory\" value=\"$activityDirectory\">\n");
$output->TextHTML("<input type=\"hidden\" name=\"filter\" value=\"$filter\">\n");
$output->TextHTML("<input type=\"hidden\" name=\"operationType\" value=\"$operationType\">\n");
$output->TextHTML("<input type=\"hidden\" name=\"fileDirName\" value=\"$fileDirName\">\n");
$output->TextHTML("<input type=\"hidden\" name=\"currDir\" value=\"$currDir\">\n");
$output->TextHTML("<input type=\"hidden\" name=\"pathTo\" value=\"$pathTo\">\n");
$output->TextHTML("File Name : $pathTo<br />\n");
$output->TextHTML("<br />");

$output->TextHTML("<textarea id=\"editor\" name=\"editor\" style=\"height: 40em; width: 100%;\">");

$output->SetInputMode(_PNH_PARSEINPUT);
$output->TextHTML($fileContent);
$output->SetInputMode(_PNH_VERBATIMINPUT);

$output->TextHTML("</textarea>\n");

$output->TextHTML("<br />\n");
$output->TextHTML("<input type=\"button\" name=\"Back\" value=\"Back\" onClick=\"goURL('$backURL')\">\n");
$output->TextHTML("<input type=\"button\" name=\"Save\" value=\"Save\" onClick=\"goURL('$saveURL')\">\n");
$output->TextHTML("</form>\n");
$output->TextHTML("\n");
return $output->getOutput();
}





=====================================

function save(){

x = document.getElementById('editor').value;
alert(x);

}

=====================================

it show the old message.



but I modify the code inside the HTMLArea.js and print out the content

====================================

window.onunload = function() {
editor._textArea.value = editor.getHTML();
alert(editor._textArea.value);
};
====================================

the content is ok.

it is so confuse for me.FrownFrown

thx for reply.


amrigo
Novice

Jan 27, 2005, 3:11 AM

Post #9 of 9 (3981 views)
Shortcut
Re: [antony_csf] how to get back the content from HTMLArea ? [In reply to] Can't Post

ok here is my code (the interesting part of it!) take a look at the save function...Also my htmlarea have some diferences but dont mind use your htmlarea configuration, note that i dont use htmlreplaceall() but assign a new HTMLAREA object to the textarea i want to get the value back ...

editor = new HTMLArea("f_txt_text", editor_conf);

f_txt_text is the id of the textarea i want to get the value

so i can use editor.getHTML() method

hope this help!

<?
$conn = new db();
$conn->open();
?>
<html>
<head>
<title>noticia-edicao</title>
<script type="text/javascript" src="../inc/htmlarea/htmlarea.js"></script>
<script type="text/javascript" src="../inc/htmlarea/htmlarea-lang-pt_BR.js"></script>
<script type="text/javascript" src="../inc/htmlarea/dialog.js"></script>
<link rel="stylesheet" type="text/css" href="../inc/htmlarea/htmlarea.css"/>

<script type="text/javascript">

function initEditor()
{
//var editor = null;
//var editor1 = null;

var editor_conf = new HTMLArea.Config();
editor_conf.imgURL = "../inc/htmlarea/images/";
editor_conf.popupURL = "../inc/htmlarea/popups/";
editor_conf.toolbar = [
[ "separator", "bold", "separator","italic", "separator","underline", "separator" ],
[ "createlink","separator" ]
]
editor_conf.pageStyle = "body { font-family: verdana,sans-serif; font-size: 10pt; }";
editor = new HTMLArea("f_txt_text", editor_conf);
editor.generate();

}

</script>

<script language='JavaScript'>

function save() {
parent.content.document.frm.target = "control";
parent.content.document.frm.f_txt_text.value = editor.getHTML();
parent.content.document.frm.action = "../save.php";
parent.content.document.frm.submit();
}

</script>

</head>

<body onload="initEditor()">
<?
$button = new Button;
$button->addItem(" Salvar ","javascript:save()","content");
echo $button->writeHTML();
?>

<?
$form = new Form("frm", "../save.php", "POST", "control", "100%");
$form->addField("Text: ", "<textarea id='f_txt_text' name='f_txt_text' rows='10' cols='50'>$bd_txt_text</textarea>");
$form->addField("Date: ", DateTimeField("f_dth_date",$bd_dth_date,"f_dth_hour",$bd_dth_hour));
echo $form->writeHTML();

?>

</body>
</html>

<?
$conn->close();
?>

 
 
 


Search for (options)