I usually add the clear form button to HTML forms by default, but tonight I had what alcholics call a "moment of clarity". Why the hell do we add this? In all my years of using the internet I have never gotten to the end of the form and thought "crap!, I screwed up, I need to reset this!". Is this button actually necessary or a hold over from another time?
The <input type="reset"> defines a reset button which resets all form values to its initial values.
To clear all the input in an HTML form, use the <input> tag with the type attribute as reset.
If you don't have any submit button it is acceptable after all it is an element of form tag and if it is not required you may not add it with in form . This will not broke any web standard.
Clicking the reset button restores the form to its original state (the default value) before the user started entering values into the fields, selecting radio buttons, checkboxes, etc.
I stopped adding those about 1997. It really bothers me when I fill out a large form and accidentially hit the Clear button. I am not really sure why they were ever used in the first place. You're right, I don't think I've ever filled out a form and said to myself, "Oh wait a minute, I think I want to start over?"
The nice thing about the reset button is that it will repopulate all form elements with their original values, not simply set them to zero or blank. So if the form was generated by server with saved data, the user makes a bunch of changes, and then realizes not only that something is wrong but that they also have no clue what the original value was, reset is VERY handy.
Also it's nice for forms with lots of numerical data, like the timesheet page I'm working on right now. There are potentially 16 fields, all with generic, somewhat meaningless numbers. If the user figures out they were looking at the wrong schedule, it's nice to just nuke it back to what the server loaded.
Having said all of that, my page does NOT include a reset button, simply because I didn't want to leave open the exact opposite of awesome it presents, which is "and I'll just click this button to save...oh shit."
What I do instead is any field can be set to 0, but any non-valid data (non-numeric, less than 0, greater than 16) will revert back to the value last entered (which is stored via js). Doesn't offer the grand sweep, but it at least lowers the amount of possible data entry errors and keeps the user from losing data over a simple mistake.
456 has a great article and link on this topic, by the way.
No, we don't need it. I usually just hit the Refresh button.
And then remember it's a @$#$@# Flash website.
In what situation would you enter totally wrong information for 10+ fields before realizing it? And then, how much time does it save to clear them before starting over instead of just changing each value? It's adding a major UI element that is not only completely useless, but dangerous for 99.99% of your users so the remaining .01% saves maybe 1 second of their time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With