/    Sign up×
Community /Pin to ProfileBookmark

Form submit, but stay on same page?

Whenever I submit information with an ‘onSubmit()’, the current page is exited
and either a new page or refreshed version of the current page is displayed.

Is there a way to submit the information, but remain on the current page?
I am submitting to a FormMail.cgi if that makes any difference.

Thanks for any response.

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@abou_hmedMay 14.2007 — you need to make a redirection inside ur cgi file to go back to the same page
Copy linkTweet thisAlerts:
@JMRKERauthorMay 14.2007 — I can do that, but it resets all the elements (text,textarea,etc.) to their initial conditions.

I would like to not lose this information and I think it is too much info for a cookie.

Thanks for the thought and I'll give it a try anyway.
Copy linkTweet thisAlerts:
@abou_hmedMay 14.2007 — try to redirect ur data as parameter also or make it into an array and set it on a session but i guess the first option is more preferable. r u ok with it?
Copy linkTweet thisAlerts:
@felgallMay 14.2007 — set the action to the current page written in a server side language. At the top of the code test if the post fields are available and if so process them before displaying the form.
Copy linkTweet thisAlerts:
@DokMay 15.2007 — Do as felgall suggest or use a XMLHttpRequest object for posting the data
×

Success!

Help @JMRKER 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 4.29,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

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