Solved

Resend form data without confirmation via javascript.

Posted on 2011-03-15
3
2,718 Views
Last Modified: 2012-05-11
I have a simple process that clears a content cache.  On the callback of the confirm, the page reloads.  When the page reloads, the standard "are you sure" message pops up asking the end user if they want to reload and resend the form contents.  Is there anything that I can add to the script that would tell the browser not to bother asking, since they have already confirmed clearing the cache, which requires reloading the page to rebuild the cache from the db?

The key would be here:
function callback(text){
      location.reload(true);     /////tell it not to ask.....
}

TIA!
<script>

	function submitForm() {
		$("#dialog-confirm").dialog({
			resizable: 0,
			height:		175,
			width:		483,
			modal:		1,
			position:	[500,250],
			buttons: {
				'Clear Script/Template Cache': function() {
					ColdFusion.Ajax.submitForm('clearCacheForm', '<cfoutput>#request.url#</cfoutput>admin/<cfoutput>#request.thisModule#</cfoutput>/act/act.clearCache.cfm', callback, errorHandler);
					$(this).dialog('close');
				},
				Cancel: function() {
					$(this).dialog('close');
					$("#accordion").accordion("activate", 0);
				}
			}
		});
	}

	function callback(text){
		location.reload(true);
	}

	function errorHandler(code, msg) {
		alert("Error!!! " + code + ": " + msg);
	}

</script>

Open in new window

0
Comment
Question by:brianmfalls
3 Comments
 
LVL 7

Accepted Solution

by:
Gewgala earned 300 total points
ID: 35142522
I don't believe this is something you can control, and would fall outside the scope of Javascript's capabilities.  For security reasons the browser asks the user if they want to resend.
0
 
LVL 4

Assisted Solution

by:dwkd
dwkd earned 200 total points
ID: 35142525
I dont think you can re-post a form without user's permission. I think it's a browser security measure

Have you tried doing it through an AJAX request? and not have to reload
0
 
LVL 1

Author Comment

by:brianmfalls
ID: 35142599
The overall process is pretty complex.  Unfortunately, we can't leverage Ajax any further than what we have already done.  I figured that it wouldn't be anything that we could control.  Still, it was worth asking.  Thanks guys.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

747 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