tags:

views:

185

answers:

1

I am having an issue with the following code. The execute function executes not on the submit of the form (there is a button being created) but before the dialog even appears. The flow of the program is simply you click on a button and the dialog is supposed to be created. Any help would be greatly appreciated.

dojo.addOnLoad(function(){
   theDialog = new Dijit.Dialog({});
   theDialog.attr("Class", "soria");
}
function createDialog(){
   theDialog.attr("title", "Add New");
   theDialog.attr("Content", buildContent());
   theDialog.attr("execute", alert('hello'));
   dojo.parser.parse(theDialog.parentNode);
   theDialog.show();
}
+2  A: 

This is independent of Dojo. The arguments of a function are evaluated before calling the function. Perhaps you meant to quote "alert('hello')" and pass the string? Otherwise, the alert gets evaluated immediately.

peller
That was the problem.
mmontalvo
Now there is an error that states this.execute is not a function. Any ideas?
mmontalvo
nevermind, I did not look at your first response closely enough. Thanks for your help
mmontalvo