Merc
Merc

Reputation: 17067

Existing widgets not available in a widget template in some (strange) cases

This took me a while. A long while. I battled two problems at once (circular dependencies, fixed with refactoring, and this problem). To get this problem into a JSFiddle required a LOT of work... but I think it was worth it. So:

http://jsfiddle.net/EVbTL/3/

I define three widgets:

Pretty uninteresting.

It's a simple custom widget, defined in this very file, which does validation. NOTE: I know there is no point in having a subclass here for this little work. Please keep in mind that this is an example.

An augmented ValidationTextBox with some extra validation.

If you click on the button, you get:

Uncaught Error: Could not load class 'app.ValidationPassword 

...?!? app.ValidationPassword has definitely been defined. It ought to be available there. At the beginning, I thought it was because of aa circular dependency (it was very fun, yesterday: I had to learn about AMD circular dependencies WHILE trying to figure out this problem...)

If you uncomment this line, executed within the script:

TEST = new r.RetypePasswordDialog();

The whole thing works. It's a meaningless instance, and I cannot figure out why on earth this would or should make a difference.

Explanations most welcome... I couldn't find any!

Thank you,

Merc.

Upvotes: 0

Views: 54

Answers (1)

McDowell
McDowell

Reputation: 108899

app = new r.AppMainScreen( {});

You redefine the global app variable here, but are trying to use it elsewhere as the base object for your type system. Use var to scope variables to the function.

Upvotes: 1

Related Questions