View Full Version : Auto Save Form Processing Previous Form Submission

06-26-2012, 04:15 PM
1) Script Title: Auto Save Form script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex16/autosaveform.htm

3) Describe problem: LOVE it....except for one flaw.....and it is a biggie. I have a site where users enter multiple customer phone calls with many details. Seems the Backspace (also navigational) is causing some issues if they are not in focus on a field....this seemed to be the perfect solution and works (well kind of...) until a second or third, etc call is added. Then if they hit the Backspace it takes them to the form unavailable page in the browser, but when you click on "try Again" it is resubmitting the previous call to the database....not taking you to the new form....until you start in to add a new call, then the fields populate with what was saved....but you have that "extra" call to delete.

Also noticed before (on the first call entered) it took you back to the screen just before the form where properties are selected....not to the form itself - have id in form as required, but the selector is in a previous file that leads to this one. This was not optimal, but could be "explained" because once the property was selected and the new form showed up within seconds the data was back that had been entered. How would I get it to not resubmit data to the database? Seems it is also caching the "submit" button?:confused:

06-26-2012, 07:40 PM
Hmm what you're describing seems to just be the default behavior of most browsers- when you press the "backspace" key while the focus is not on a form element, it acts as the "back" button, taking the user back one page in the browser history. If the form was previously submitted, that could mean a "form unavailable" page.

To confirm the above- what happens if you remove or disable the Auto Saving script- does the problem go away with the form submission issue?

06-27-2012, 12:33 AM
The Backspace key was the original issue....I have never had a problem when testing over two years myself, but some users apparently are taking the focus off a form element and hitting Backspace and losing data. I installed a script over the weekend, that allowed the backspace only for correcting text....but it left off textareas (except oddly those using a wizzy). I tried adding textareas as an option but my limited javascript skills (still learning!) apparently had no effect. This is a site with thousands of pages and hundreds of forms, but a couple of "biggies". So, eliminating that script, I found the auto save on DD and thought it would be perfect. Basically the behavior of the form/process on the website is a user selects one variable (an agency) and is directed to the next page to select a related variable (a property). Once those are selected, it takes them to a form to enter telephone call details for that property at that agency.

Without the Auto Save, if someone takes focus off a form element and hits Backspace all is lost, takes them to a Document Expired (or the like depending on browser) page.

With Auto Save, it saves things like a charm! Except if you hit Backspace while out of focus on the first call you enter it makes you re-select the property, but when you come back to the main call entering form, after a brief second the data populates the fields. That is something I could live with and explain away....but it is what happens on the second, third, etc... call (and this form is used by people entering hundreds at a time)...if you take focus off and hit Backspace then it resubmits the previously submitted/saved call. The data that was auto saved is still there when you return to the call entering form (which is good), but you have that nasty "extra" call you have to go in and delete.

Is there a way to unset HTML5's DOM storage? after the form is submitted? Is that where the issue is?

07-09-2012, 04:38 AM
Any help would be appreciated. I am about to yank it from my testing pages as it is delaying the whole project...