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 switch the editor to text-mode before submitting the form?


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.

 


ronnie98
Novice

Aug 22, 2004, 6:51 PM

Post #1 of 5 (3148 views)
Shortcut
How to switch the editor to text-mode before submitting the form? Can't Post

Hi all,
i need to switch the editor to text-mode before submitting the form which contains the textarea.
I don't want to do it manually by pressing the button on the toolbar but pushing the submit button in the form the following action should be perfomed:

1)switch editor to text-mode (the function i need/miss)
2)submit the content to the file
3)close the window

I need only function 1) and i hope you can help me.
ATB,ronnie.


Evervision
Novice

Aug 23, 2004, 1:28 PM

Post #2 of 5 (3128 views)
Shortcut
Re: [ronnie98] How to switch the editor to text-mode before submitting the form? [In reply to] Can't Post

The function setmode is part of the editor. You can find it in htmlarea.js. With no arguments, its like pushing the button, it switches between modes. You can also tell it which mode you want, and it will switch to that mode.

Jason


ronnie98
Novice

Aug 23, 2004, 6:27 PM

Post #3 of 5 (3123 views)
Shortcut
Re: [Evervision] How to switch the editor to text-mode before submitting the form? [In reply to] Can't Post

Thamk you evervision.
I found this:

Code
HTMLArea.prototype.setMode = function(mode) { 
if (typeof mode == "undefined") {
mode = ((this._editMode == "textmode") ? "wysiwyg" : "textmode");
}
switch (mode) {
case "textmode":
this._textArea.value = this.getHTML();
this._iframe.style.display = "none";
this._textArea.style.display = "block";
if (this.config.statusBar) {
this._statusBar.innerHTML = HTMLArea.I18N.msg["TEXT_MODE"];
}
break;
case "wysiwyg":
if (HTMLArea.is_gecko) {
// disable design mode before changing innerHTML
try {
this._doc.designMode = "off";
} catch(e) {};
}
if (!this.config.fullPage)
this._doc.body.innerHTML = this.getHTML();
else
this.setFullHTML(this.getHTML());
this._iframe.style.display = "block";
this._textArea.style.display = "none";
if (HTMLArea.is_gecko) {
// we need to refresh that info for Moz-1.3a
try {
this._doc.designMode = "on";
} catch(e) {};
}
if (this.config.statusBar) {
this._statusBar.innerHTML = '';
this._statusBar.appendChild(document.createTextNode(HTMLArea.I18N.msg["Path"] + ": "));
this._statusBar.appendChild(this._statusBarTree);
}
break;
default:
alert("Mode <" + mode + "> not defined!");
return false;
}
this._editMode = mode;
this.focusEditor();

for (var i in this.plugins) {
var plugin = this.plugins.instance;
if (typeof plugin.onMode == "function") plugin.onMode(mode);
}
};


Can you tell me what i have to put in the <input> tag of the form.
Ex:

Code
<input class="button" type="button" value="Save" onClick="What_i_have_to_insert_here?">


At last:are there parts of the function that i can delete,since i may not need them?

Sorry for this newbie question.
Thanks again,ronnie


(This post was edited by ronnie98 on Aug 23, 2004, 6:29 PM)


SmegmaGun
Novice

Feb 5, 2005, 9:06 AM

Post #4 of 5 (2738 views)
Shortcut
Re: [ronnie98] How to switch the editor to text-mode before submitting the form? [In reply to] Can't Post

function SwitchMode() {
editor.setMode("textmode");
}

<input type=submit name=submit value='submit' onclick='SwitchMode();'>

If your pages are very long use this before submitting. It will go a lot faster


reg
Novice

Feb 5, 2005, 7:14 PM

Post #5 of 5 (2714 views)
Shortcut
Re: [SmegmaGun] How to switch the editor to text-mode before submitting the form? [In reply to] Can't Post

Sounds like a very useful function. Is there an easy eway to have it cycle through all objects and switch those that are htmlareas (and skip the rest) or does that just eat up the time saved by making the switch. I ask because my forms are gnerated from meta-data and I do not know at design time how many htmlarea objects I will have on the page nor what they will be called

Thanks

Reg

 
 
 


Search for (options)