Solved

Resend form data without confirmation via javascript.

Posted on 2011-03-15
3
2,755 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

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 …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

773 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