Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear form button in HTML...do we really need this?

Tags:

html

dom

forms

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?

like image 453
craigmoliver Avatar asked Sep 30 '09 01:09

craigmoliver


People also ask

Why do we use reset button in HTML forms?

The <input type="reset"> defines a reset button which resets all form values to its initial values.

How do you clear a form in HTML?

To clear all the input in an HTML form, use the <input> tag with the type attribute as reset.

Do you need a button to submit a form?

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.

Which button clears all the fields in the form?

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.


4 Answers

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?"

like image 172
Brian Behm Avatar answered Oct 04 '22 14:10

Brian Behm


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.

like image 44
Anthony Avatar answered Oct 04 '22 12:10

Anthony


No, we don't need it. I usually just hit the Refresh button.

And then remember it's a @$#$@# Flash website.

like image 8
MusiGenesis Avatar answered Oct 04 '22 14:10

MusiGenesis


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.

like image 6
Rex M Avatar answered Oct 04 '22 13:10

Rex M