#4801 closed enhancement (fixed)
Add Button type of 'reset' to dijit.form.Button
Reported by: | guest | Owned by: | Douglas Hays |
---|---|---|---|
Priority: | high | Milestone: | 1.1 |
Component: | Dijit - Form | Version: | 0.9 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
The dijit.form.Button widget should accept Reset as a type when the onClick function is called, just like it currently does Submit. The code would be very similar to add this functionality.
onClick: function(/*Event*/ e){ // summary: callback for when button is clicked; user can override this function // for some reason type=submit buttons don't automatically submit the form; do it manually if(this.type!="button"){ for(var node=this.domNode; node; node=node.parentNode){ if (this.type == "submit") { var widget=dijit.byNode(node); if(widget && widget._onSubmit){ widget._onSubmit(e); break; } if(node.tagName.toLowerCase() == "form"){ node.submit(); break; } } else if (this.type == "reset") { if(node.tagName.toLowerCase() == "form"){ node.reset(); break; } } else { console.error("Unknown dijit.form.Button type: " + this.type.toString()); break; } } } },
Attachments (2)
Change History (9)
comment:1 Changed 13 years ago by
Milestone: | → 2.0 |
---|
comment:2 Changed 13 years ago by
Why not patch them to support normal forms though? attached is a patch that will enable normal forms to work with dijit.form.Button and reset()
comment:3 Changed 13 years ago by
Also attaching my proposal for a fix for submit... should actually be its own ticket I suppose...
comment:4 Changed 13 years ago by
Milestone: | 2.0 → 1.1 |
---|---|
Owner: | set to Douglas Hays |
Hmm, didn't you already do this as part of the reset work?
comment:5 Changed 13 years ago by
So a reset button inside a form widget just works w/o anything special. Currently, a reset Button in a Dialog (do we support that??) doesn't do anything.
comment:6 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
OK, that's good enough, covers the essence of the bug (which was to support form reset).
comment:7 Changed 10 years ago by
Component: | Dijit → Dijit - Form |
---|
Reset is a complicated issue in the sense that all the form widgets have to know how to revert to their original value, etc. Marking for 2.0.