When does JavaScript get executed in FF-XForms?

Adam FLinton <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xml
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Dear All,

We have an XML structure which consists of classes, attributes etc each 
with a child element of annotation into which XHTML fragments can be 
placed (mostly just display markup (bold underline etc).

We have a need to be able to edit these annotation elements in a 
"WYSIWYG" way. The annotation would live in a textarea

There are lots of JavaScript based editors which allow for exactly this.

However it seems to be impossible to put the editors into Mozilla.

In the Novell plugin for IE the editors load & work fine.

as an example, download the tiny_mce editor into a folder beneath where 
the XForm file is run from & add:

<script language="javascript" type="text/javascript" 
src="./tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
		<script language="javascript" type="text/javascript">
tinyMCE.init({
	mode : "textareas"
	
	
	
}); </script>

Obviously adapt the src path to suit.

This in essence says "where ever you find a textarea put in tiny_mce".

However if you load this (or any other JavaScript WYSIWYG XHTML editor 
you get:

Error: uncaught exception: [Exception... "Object cannot be created in 
this context"  code: "9" nsresult: "0x80530009 
(NS_ERROR_DOM_NOT_SUPPORTED_ERR)"  location: 
"file:///D:/Data/Hl7/XML/XForm/Test/tinymce/jscripts/tiny_mce/tiny_mce_src.js 
Line: 253"]


This line is the id'ed one:

	document.write('<sc'+'ript language="javascript" type="text/javascript" 
src="' + url + '"></script>');

from within:

TinyMCE.prototype.loadScript = function(url) {
	for (var i=0; i<this.loadedFiles.length; i++) {
		if (this.loadedFiles[i] == url)
			return;
	}

	document.write('<sc'+'ript language="javascript" type="text/javascript" 
src="' + url + '"></script>');

	this.loadedFiles[this.loadedFiles.length] = url;
};


However each Javascript script blows with an 
NS_ERROR_DOM_NOT_SUPPORTED_ERR error.


e.g. with another (whizzywig):

Error: uncaught exception: [Exception... "Object cannot be created in 
this context"  code: "9" nsresult: "0x80530009 
(NS_ERROR_DOM_NOT_SUPPORTED_ERR)"  location: 
"file:///D:/Data/Hl7/XML/XForm/Test/whizzywig.js Line: 483"]

where again it's a document.write:

function w(string) { return document.write(string); }


So is there a fundamental problem trying to use javascript to rewrite 
the contents of textareas?

I have even tried mozile as a moz/ff only option (back to ye olde detect 
browser) but then I get:

Error: Error in parsing value for property '-moz-user-select'. 
Declaration dropped.
Source File: file:///D:/Data/Hl7/XML/XForm/Test/MifEditor.css
Line: 7

where the css is:

-moz-user-select: normal;

Any hints, clues etc readily adopted as I would like a single XForm 
which works across platforms & browsers if possible.

Adam
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.