/    Sign up×
Community /Pin to ProfileBookmark

Submit and Reset at the same time?

Is it possible to Submit a form and have an onclick reset the form at the same time while opening a new “thank you” window? I have tried this way but in my forms output I just get a “?” for each field I typed data into.

<input type=”submit” value=”Submit” onclick=’reset()’>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@felgallFeb 16.2006 — try putting onsubmit="this.reset()" in the form tag instead.
Copy linkTweet thisAlerts:
@HDCauthorFeb 16.2006 — Thanks felgall, that did work however in my output the field data turned into a "?" for each character in every field. Is this a problem with my cgi script or javascript? When I take out the onsubmit I get the correct data output for each field. This is the code I'm using.

<FORM action="/cgi-bin/xxx.pl" name="f" target="_new" onsubmit="this.reset()">
×

Success!

Help @HDC 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.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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