Chin
Chin

Reputation: 12712

dijit.byId returns undefined

I have a hidden form and I am trying to put it into a variable via dijit.byId Unfortunately it always returns undefined.

Am I missing something? dojo is flummoxing me at every corner - any help much appreciated.

js:

dojo.require("dijit.form.Form");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.ValidationTextBox");

dojo.addOnLoad(function() {
var regForm = dijit.byId("hiddenRegister");
//regForm is undefined
});

html:

<div id="hiddenRegister" dojoType="dijit.form.Form"  jsId="hiddenRegister" encType="multipart/form-data" action="" method=""></div>

Upvotes: 0

Views: 4196

Answers (1)

Ali Gangji
Ali Gangji

Reputation: 1501

id and jsId should not be the same

and if you are using jsId, then there is no need for dijit.byId. The widget is already assigned to a variable using the jsId as the variable name.

Upvotes: 2

Related Questions