Opened 14 years ago

Closed 14 years ago

Last modified 11 years ago

#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:


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
			for(var node=this.domNode; node; node=node.parentNode){
				if (this.type == "submit") {
					var widget=dijit.byNode(node);
					if(widget && widget._onSubmit){
					if(node.tagName.toLowerCase() == "form"){
				} else if (this.type == "reset") {
					if(node.tagName.toLowerCase() == "form"){
				} else {
					console.error("Unknown dijit.form.Button type: " + this.type.toString());

Attachments (2)

buttonreset.diff (778 bytes) - added by tk 14 years ago.
dijit.form.Button type="reset"
button.diff (769 bytes) - added by tk 14 years ago.
proposed type="submit" fix as well…

Download all attachments as: .zip

Change History (9)

comment:1 Changed 14 years ago by bill

Milestone: 2.0

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.

comment:2 Changed 14 years ago by tk

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()

Changed 14 years ago by tk

Attachment: buttonreset.diff added

dijit.form.Button type="reset"

Changed 14 years ago by tk

Attachment: button.diff added

proposed type="submit" fix as well...

comment:3 Changed 14 years ago by tk

Also attaching my proposal for a fix for submit... should actually be its own ticket I suppose...

comment:4 Changed 14 years ago by bill

Milestone: 2.01.1
Owner: set to Douglas Hays

Hmm, didn't you already do this as part of the reset work?

comment:5 Changed 14 years ago by Douglas Hays

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 14 years ago by bill

Resolution: fixed
Status: newclosed

OK, that's good enough, covers the essence of the bug (which was to support form reset).

comment:7 Changed 11 years ago by bill

Component: DijitDijit - Form
Note: See TracTickets for help on using tickets.