/    Sign up×
Community /Pin to ProfileBookmark

Prevent Reset Button from immediately clearing a form

Greetings!

n00b javascript programmer here. What I’ve got going on is a form with a reset button — tied to HTML forms, if you press the escape key, it activates the reset button on a form and subsequently clears the data out of it. I want to prevent this on first press (e.g. necessitating that if someone ‘accidenty’ presses the ESC key on their keyboard, they don’t also ‘accidently’ lose all the data in the form).

Is there something that I can code in that will sort of ‘verify’ that they indeed want to clear the form via a pop up Yes/No alert box — and pending they click No, it retains the data in the form?

Any help would be greatly appreciated!

Thanks,

  • SAM
  • to post a comment
    JavaScript

    1 Comments(s)

    Copy linkTweet thisAlerts:
    @rootApr 27.2007 — Were getting allot of "DOUBLE POSTS" lately, patience is the name of the game, if you post and you dont get an answer, REVISIT the ORIGINAL post, dont create MORE junk that only goes to waste peoples time as one thread MAY be answered and another may be discovered later and the poster may be UNAWARE that the problem has been "RESOLVED"

    Be a bit more considerate to the OTHER board users as everyon helps here on a voluntary basis and your only wasting their time and effort.
    ×

    Success!

    Help @phaex spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.10,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,
    )...