Solved

RESET FORM DATA AFTER SUBMIT

Posted on 2003-12-05
6
1,679 Views
Last Modified: 2011-09-20
Hi i'm new to the forum, as far as posting is concerned.
I've searched about and about on this topic, and have found numerous topics, but none to explain really exactly what I need.

I am submitting data from a form to an SQL db, and works great and fast.
I redirect to confirmation page after submission.

My question is how do I make the form reset after I post?
I see a bunch of stuff, but am lost
Any help would be greatly appreciated.

Here's the code:

<form name="form1" method="POST" action="/jmm/test.asp?" onSubmit="nrt_validateForm('firstName','','R','lastName','','R','homePhone','','RisNum','workPhone','','NisNum','mobilePhone','','NisNum','emailAddress','','RisEmail','comments','','R');return document.nrt_returnValue">
0
Comment
Question by:jmazur01
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:Macorc
Comment Utility
If you post the form to a new file ... the browser window should replace the old document with the new one, isn't it?

I don't understand the question. If the browser window gets replaced, why do you need to reset the form? it will be destroyed anyway.
0
 

Author Comment

by:jmazur01
Comment Utility
Ok, well if the user goes back to the page, the data is still there and he/ she can re-submit
If he/she hits refresh, the data is re-sent to the SQL server

thanks for the prompt reply  
0
 
LVL 18

Expert Comment

by:SquareHead
Comment Utility
Maybe this would work:

When you submit the form, also set a session variable -- something like Session("form_submitted") = "yes"

Then check for that session var whenever the form page loads -- either through normal methods, or by hitting the back button, and if the session var is there and it says "yes", then execute a javascript that resets the form...

Another option is to submit the form to a separate page that does the processing, then redirects the user back to the original form page...

0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 1

Accepted Solution

by:
Macorc earned 250 total points
Comment Utility
Ok, I understand. Both options from SquareHead seem good to me, though didn't try them. Another solution could be to reset the form always when the page loads. Something like:

<body onload="document.forms['FormName'].reset()">

I didn't try this either to check if it is really working when going back with the browser button.
0
 
LVL 1

Expert Comment

by:Macorc
Comment Utility
By the way, If you don't want the user to be able to re-submit the data you should do what SquareHead says, and have every different step in the process in a different file.

Form->Process->Confirm success
0
 

Author Comment

by:jmazur01
Comment Utility
Thank you all so very much!
that worked perfect!

Have a Safe and Happy Holiday Season!!

--jmm
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now