/    Sign up×
Community /Pin to ProfileBookmark

How do i reload a page and still keep the information on the page?

My submit button will disappear after being clicked (to prevent users from clicking many times): this.style.display=’none’;
I know that it’s not really the best practice but it’s what i have now.
However, i run into another problem. Sometimes, users miss a couple fields in the form. Then they hit “Submit,” and i have a window popup telling them that they need to complete the form before submitting it. By then, the “submit” button has already disappeared. So i use location.reload (true) to have the “submit”button again. However, all data that’s been filled by users are lost.
Is there a way to refresh the page without losing already filled out data.
Thanks.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@mrhooJan 23.2007 — Don't make the submit button disappear until after the form passes your validation code.
Copy linkTweet thisAlerts:
@JackBauerauthorJan 23.2007 — ^^ could you elaborate more?

Thanks
Copy linkTweet thisAlerts:
@mrhooJan 23.2007 — Don't make the style change when you click the button-

The validation code is called first and itself calls 'submit()' when it has validated correctly. Find the call to 'submit()' and script the button's display immediately before it.
Copy linkTweet thisAlerts:
@JackBauerauthorJan 24.2007 — Thanks so much. It works like a charm.
×

Success!

Help @JackBauer 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...