SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot matches's Avatar
    Join Date
    Aug 2006
    Posts
    196
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    reset form as test link instead of button

    Hello all,

    Is there a way to make a reset form

    Code:
    <INPUT TYPE=RESET>
    a text link instead of a button?

    Thanks

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,140
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    You could have javascript do a reset() after a link's onclick event.

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    Birnam wood is come to Dunsinane

  4. #4
    Design Your Site Team bronze trophy Erik J's Avatar
    Join Date
    May 2007
    Location
    Countryside, Sweden
    Posts
    3,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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)
    HTML Code:
    <input type="reset" value="Delete All Values" style=" background:transparent; color:blue; text-decoration:underline; cursor:pointer">
    Happy ADD/ADHD with Asperger's

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,140
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    I have never wanted a button to look like a link, but this is much better than using cludgy javascript to get the effect.
    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.

  6. #6
    Design Your Site Team bronze trophy Erik J's Avatar
    Join Date
    May 2007
    Location
    Countryside, Sweden
    Posts
    3,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mittineague
    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.
    Happy ADD/ADHD with Asperger's

  7. #7
    SitePoint Wizard bronze trophy Tailslide's Avatar
    Join Date
    Feb 2006
    Location
    Bedford, UK
    Posts
    1,687
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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!
    Little Blue Plane Web Design
    Blood, Sweat & Rust - A Land Rover restoration project

  8. #8
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,140
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    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).

  9. #9
    SitePoint Addict Aarem's Avatar
    Join Date
    Aug 2008
    Posts
    245
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •