dojo.hitch scope issue in onsubmit dojo/method
I have a onsubmit dojo/method within a custom templated widget like so:
try { if (this.validate()) { //console.debug(this); SubmitForm(dojo.hitch(this, this.Send)); } } catch (e) { console.debug(e); } return false;
When I call this, the scope within the dojo/method is dijit.Form. How would I go about getting the scope of the templ开发者_StackOverflow中文版ate widget instead?
I solved it by doing this:
dojo.connect(dojo.byId(this.form.id), "onsubmit", dojo.hitch(this, function(e) { e.preventDefault(); if (this.GetForm().validate()) { SubmitForm(dojo.hitch(this, this.Send)); } }) );
精彩评论