?
Solved

RESET FORM DATA AFTER SUBMIT

Posted on 2003-12-05
6
Medium Priority
?
1,700 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:Macorc
ID: 9881656
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
ID: 9881722
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
ID: 9882131
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 1

Accepted Solution

by:
Macorc earned 1000 total points
ID: 9882384
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
ID: 9882397
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
ID: 9882877
Thank you all so very much!
that worked perfect!

Have a Safe and Happy Holiday Season!!

--jmm
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

762 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