You are not logged in.
Pages: 1
Well, I searched both the forum and the tickets about this and seems there no post about it : Have you guys tried to use the onChange javascript handler on a xinha/htmlarea field? Things seems to work if I let my textarea field as a normal one but as soon as I switch it to a htmlArea field, my function doesn't get called and I can't warn the user about clicking a link before saving the changes...
Any tips about this or documentation I missed somewhere?
Thanks in advance
Offline
has anyone found a solution for this?
Offline
you might take a look at this:
http://xinha.python-hosting.com//ticket/89
and my last comment
Niko
Offline
Thanks Niko.
Is there any way to set this from outside xinha so that it won't be broken during an upgrade.
I tried:
window.xinha_editors.editor.onKeyPress = function() {somefunc();}
but it doesnt seem to do anything?
Offline
i did write a little plugin:
function CheckOnKeyPress(editor) {
this.editor = editor;
}
CheckOnKeyPress._pluginInfo = {
name : "CheckOnKeyPress",
version : "1.0",
developer : "",
developer_url : "",
c_owner : "Niko Sams",
sponsor : "",
sponsor_url : "",
license : "htmlArea"
};
CheckOnKeyPress.prototype.onKeyPress = function(ev) {
editor = this.editor;
var id = editor._textArea.id;
var re = /_([0-9]+)$/;
id = id.match(re);
checkRow(id[1]);
}
Last edited by niko (2005-05-19 08:10:52)
Niko
Offline
That plugin did the thing nicely :-)
Thanks for taking the time to reply to this post !
Offline
Works for me as well.
Thanks very much Niko.
Offline
Hi,
I thought it was working but I get a blank textarea when I try to call the plugin.
I don't get any script errors.
Other plugins work fine.
I created a folder in the plugins dir called CheckOnKeyPress
and copied and pasted the plugin to a file called check-on-key-press.js in that directory.
I think I must be doing something dumb.
Offline
You got me worried for a few seconds there... but, indeed, my texts/htmlareas are just fine.
I didn't put it into the plugins dir because I wished to keep it while I could update xinha independtly. I just put this code :
CODE
<script type="text/javascript" language="javascript">
function CheckOnKeyPress(editor) {
this.editor = editor;
}
CheckOnKeyPress._pluginInfo = {
name : "CheckOnKeyPress",
version : "1.0",
developer : "",
developer_url : "",
c_owner : "Niko Sams",
sponsor : "",
sponsor_url : "",
license : "htmlArea"
};
CheckOnKeyPress.prototype.onKeyPress = function(ev) {
formChanged(); // My change handler for the whole form
}
</script>
ENDCODE
And added the plugin name in my plugin array before building the htmlareas and all is just fine
Offline
thass more like it! Thanks Chuck. Much appreciated.
Offline
the file must be called check-onkey-press.js i think
check web-server-error logs on that....
....imho upgrading to a newer xinha-version should be no problem at all with a custom plugin - as you only have to copy the plugin-folder
Niko
Offline
Hi,
This is my first time posting here
NIko I couldn't get your plugin to fully work...
In the CheckOnKeyPress.prototype.onKeyPress = function(ev)
what is checkRow(id[1]);?
also after
editor = this.editor;
var id = editor._textArea.id;
how can i access the editor._textArea.value? I always get an empty string before using submiting button.
and last question...I suppose if the user copies and pastes text in the xinha area...with the mouse.....this will not be handled...
is there a way to handle that?
Or maybe the classic textarea "onchage" functionality has been restored, and i am not aware?
thanks so much guys for your help and the awesome xinha
alex
i did write a little plugin:
function CheckOnKeyPress(editor) { this.editor = editor; } CheckOnKeyPress._pluginInfo = { name : "CheckOnKeyPress", version : "1.0", developer : "", developer_url : "", c_owner : "Niko Sams", sponsor : "", sponsor_url : "", license : "htmlArea" }; CheckOnKeyPress.prototype.onKeyPress = function(ev) { editor = this.editor; var id = editor._textArea.id; var re = /_([0-9]+)$/; id = id.match(re); checkRow(id[1]); }
Offline
hi,
the checkRow-function is a function from my CMS, you won't need it...
use editor.getHTML()
Niko
Offline
Just wanted to bump this, to see if there's a way to get behavior more like "onchange" -- clicking toolbar items can also change the content without using the keyboard, I'd like to be able to know whenever the content of the editor changes.
Offline
Pages: 1