Opened 15 years ago

Closed 15 years ago

#3186 closed defect (wontfix)

Editor2 loading using createWidget fails

Reported by: guest Owned by: James Burke
Priority: low Milestone: 1.0
Component: General Version: 0.4
Keywords: version= 0.4.3 Cc:
Blocked By: Blocking:


I have a function 'includeLibs' that includes some other js files that i use. The includeLibs functions is called after onLoad using dojo.addOnLoad.

In the include libs function i include a js file called form.js that requires Editor2. So the form.js file has the following line:


Now whenever a form is loaded (using ajax) my script searches for editor2 components. If found it calls dojo.widget.createWidget to create an Editor2 component.

But that fails.. In the code below i get the following error message:

"dojo:editor2" widget object has no "create" method and does not appear to implement *Widget"


<textarea form-required="true" form-type="xhtml"
toolbarAlwaysVisible="true" shareToolbar="false"
useActiveX="true" htmlEditing="true"
id="messages/content" name="messages/content" class="form xhtml">
Vul in...

var element=dojo.byId("messages/content");
try {
    var editor=dojo.widget.createWidget(
        "Editor2", {htmlEditing: true},
} catch(e) {
   alert ( e.message );

I noticed this bug when switching from ( i think not sure 0.4.1 ) to 0.4.3

Change History (3)

comment:1 Changed 15 years ago by guest

After some hacking i found the cause: i loaded the Editor2 js files after page load...

I circumvent this bug by adding this line:


To the top of the first loaded .js file... But what i want is support for something like this:

dojo.addOnLoad(function() {

This is not supported... It gives me the error as i described above

comment:2 Changed 15 years ago by bill

Component: EditorGeneral
Owner: changed from liucougar to James Burke
Priority: highlow
severity: majorminor

I don't think we want to support this (as a general loader feature) but passing to jburke. Remember that the dojo.require() call can be asynchronous.

comment:3 Changed 15 years ago by James Burke

Milestone: 1.0
Resolution: wontfix
Status: newclosed

I'm curious if this happens because the reporter is using an xdomain Dojo build (and therefore the dojo.require call is asynchronous)? I'm marking as wontfix, but feel free to reopen against the 0.9 code with a testcase and an indication of how Dojo is being loaded (the regular way or the xdomain/XD way).

Note: See TracTickets for help on using tickets.