Solved

Refreshing the parent page while avoiding windows message (must resend data)

Posted on 2003-10-21
12
299 Views
Last Modified: 2013-12-24
is there anyway of refreshing the parent page without the windows message (must resend data) coming up.

These are my circumstances

1.I have a clients page and on this page the user selects the client from a drop down box and hits go.

2.Once the go button is pressed all the client sites for that particular client are displayed on this page.

3. I have the option ADD SITE on this page also and when it is clicked a popup window appears.

4. The user then enters the new site details using this pop up window and clicks add.

what i want to do is:

1. Display a message in the pop up window saying site details have been added

2.Close the popup window.

3. Then Refresh the clients page to display the latest site that has just been added

Appreciate any help,
0
Comment
Question by:jturkington
12 Comments
 
LVL 9

Expert Comment

by:CFDevHead
ID: 9591847
Are you using cfmx?
0
 

Author Comment

by:jturkington
ID: 9591938
yeah at the moment
0
 
LVL 9

Expert Comment

by:CFDevHead
ID: 9591940
If you areusing CFMX this will work

<form method="post" action="test.cfm">
<input type="text" name="fname">
<input type="text" name="lname">
<input type="text" name="phone">

<input type="submit" value="Hit Me!">
</form>
<cfoutput>
<cfif isdefined('fname')>
<cfset events= structNew() />
      <cffunction name="init" access="public">
            <cfloop collection="#form#" item="key">
                  <cfset set(key, form[key])>
            </cfloop>
            <cfloop collection="#url#" item="key">
                  <cfset set(key, url[key])>
            </cfloop>
            <cfreturn events />
      </cffunction>
      
      <cffunction name="set" access="public">
            <cfargument name="name" type="string" required="true" />
            <cfargument name="value" required="true" />      
            <cfset events[arguments.name] = arguments.value />
      </cffunction>
      
      <cffunction name="getEvent" output="true" access="public">
            <cfargument name="alias" type="string" required="true">
            <cftry>
                  <cfreturn events[arguments.alias] />
            <cfcatch>
                  <cfreturn "">
            </cfcatch>      
            </cftry>
            
      </cffunction>
      
      <cffunction name="getAllEvents" output="true" access="public">
            <cftry>
                  <cfreturn events />
            <cfcatch>
                  <cfreturn "">
            </cfcatch>      
            </cftry>
            
      </cffunction>
      
      <!--- Call the init function --->
      <cfset temp=init() />
      <!--- Call the getAllEvents function and set temp equal to the returning struct --->
      <cfset temp=getAllEvents() />
      <!--- declare the URLString variable --->
      <cfset URLString='index.cfm?'/>
      <!--- loop through the temp struct to build your URLString --->
      <cfset counter=0 />
      <cfloop collection="#temp#" item="key">            
            <cfif key is not 'FIELDNAMES'>
                  
                  <cfset URLString=#URLString# & #iif(counter is not 0,'"&"','""')# & '#key#=#temp[key]#'/>
                  <cfset counter=counter + 1 />
            </cfif>
      </cfloop>
<a href="#URLString#">Click Here To Refresh</a>      
</cfif>
</cfoutput>


use this #URLString# to refresh in the Jscript
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 9

Accepted Solution

by:
CFDevHead earned 168 total points
ID: 9591970
here is a shorter version


<form method="post" action="test.cfm">
<input type="text" name="fname">
<input type="text" name="lname">
<input type="text" name="phone">

<input type="submit" value="Hit Me!">
</form>
<cfoutput>
<cfif isdefined('fname')>
<cfset events= structNew() />

      <cfloop collection="#form#" item="key">
            <cfset events[key] = form[key] />
      </cfloop>
      <cfloop collection="#url#" item="key">
            <cfset events[key] = url[key] />
      </cfloop>

      <cfset URLString='test.cfm?'/>
      <!--- loop through the temp struct to build your URLString --->
      <cfset counter=0 />
      <cfloop collection="#events#" item="key">            
            <cfif key is not 'FIELDNAMES'>                  
                  <cfset URLString=#URLString# & #iif(counter is not 0,'"&"','""')# & '#key#=#events[key]#'/>
                  <cfset counter=counter + 1 />
            </cfif>
      </cfloop>
<a href="#URLString#">Click Here To Refresh</a>      
</cfif>
</cfoutput>
0
 
LVL 2

Assisted Solution

by:jonnygo55
jonnygo55 earned 166 total points
ID: 9591983
you are attempting to refresh a page that is a result of a form.  so if you do a simple refresh you are always going to get that popup prompting you to resubmit the form.

Two possible solutions I can think of:
1.  you could pass the client variable to the popup and back to the parent page as a url variable.  

2. you could put a form in the parent page with the passed variables as hidden...the form would then be submitted by the popup window instead of refreshing the parent.

hope that helps
0
 
LVL 9

Expert Comment

by:CFDevHead
ID: 9592005
set the #URLString# variable into javascript variable and send it to the popup then you can refresh the page with the url in the jscript variable.
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9592359
the pop up only comes when u try & resubmit values to a page !

so if the page happens to be a plain simple HTMLpage - refreshing shldnt be a problem at all
else i dont think u can eliminate the message - when u refresh it - unless u use some other means of submitting ur date once again thru [hidden forms or url's]

PS : if u r using framsets - then u can use window.document.parent[0/1/2].location ... use 0/1/2 based on the heirarchy of the frames.
0
 

Assisted Solution

by:hillmw
hillmw earned 166 total points
ID: 9593591
I would do this:

1) on the main page you have a button that executes some javascript in the main page.
var access_win;
var access_url = "http://www.myurl.com/mydoc.cfm";
if ( !access_win || access_win.closed )
     {
     access_win = open(access_url,'ck_access','resizable=yes,. ..........blah, blah, blah);
     document.login.action = access_url;
     document.login.target = 'ck_access';
     document.login.submit();
     access_win.focus();
     }
     else
     {
     access_win.focus();
     }
}
This submits the results of your main page to the pop-up window

2) do some processing of the results and ck the results of your database like:

<cfif sqlrc is not "0">
<cfset client.ErrorText  = "error here">
   <cflocation url="lean_error.cfm" addtoken="No">
<cfelse>
 <html>
 <head>
 <title> Update Results</title>
<script language="JavaScript">
function timeout(mynum)
{
var script = "self.opener.location='update_form.cfm?num=" + mynum + "';";
setTimeout(script, 1)
setTimeout("window.close();", 500);
}
</script>
</head>
<cfoutput>
<body onload="timeout(#form.mynum#);" onBlur="self.focus();" bgcolor="ffffff">      
</cfoutput>
<br><br><br><center>Data Successfully Saved</center>
</body>
</html>
</cfif>
0
 
LVL 5

Expert Comment

by:dc197
ID: 9594567
Yeah, use GET and not POST in your forms.
Simple.
0
 
LVL 9

Expert Comment

by:CFDevHead
ID: 9599042
any luck?
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

813 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

10 Experts available now in Live!

Get 1:1 Help Now