Reset form as test link instead of button

Hello all,

Is there a way to make a reset form


a text link instead of a button?


You could have javascript do a reset() after a link’s onclick event.

Not a good idea, in my opinion. It’s better to use a real button and style it to look like a link. Otherwise it won’t work with JavaScript disabled, which means you must add the link using JavaScript. That’s a lot of work for no good reason. :slight_smile:

As AutisticCuckoo already said, and I contribute with a “link”-styled button example: (but don’t use inline styling, its not semantic and pseudo-classes are unvailable)

<input type="reset" value="Delete All Values" style=" background:transparent; color:blue; text-decoration:underline; cursor:pointer">

I have never wanted a button to look like a link, but this is much better than using cludgy javascript to get the effect. :tup:
The snippet erik.j posted works fairly well, although adding a border:none will get rid of the button’s outline. Seems OK in IE and Firefox, but Opera doesn’t show the text underline for some reason.

Thanks for testing it, I was too lazy and didn’t think of the borders and probably there still is the 3D effect that my lazy inline style doesn’t remove. :slight_smile:

Here’s a question for you - do you really need a reset button/link at all? Why would a user need to reset a form?

Personally I’ve never reset a form - I HAVE however hit the reset button by accident quite a few times and then had to re-enter all the information!

Other than testing them to see if they worked, I think the only time I have ever “reset” was to clear radio buttons that didn’t have a “none” option.
I can’t really see where I would want to use one otherwise, unless I totally messed up in a simple form and wanted to wipe it. I usually go back to the input with the mistake and fix it rather than wipe the entire form (when I don’t miss the mistake before submitting).

I prefer sticky forms (where the information is not wiped after submitting). The only use of a clear button is if the user needs to fill the form out over and over again, which is very rare, I would have thought.