Solved

RESET FORM DATA AFTER SUBMIT

Posted on 2003-12-05
6
1,697 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
LVL 1

Accepted Solution

by:
Macorc earned 250 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

695 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