Solved

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

Posted on 2003-10-21
12
297 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
 
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
Save on storage to protect fatherhood memories

You're the dad who has everything. This Father's Day, make sure your family memories are protected. My Passport Ultra has automatic backup and password protection to keep your cherished photos and videos safe. With up to 3TB, you have plenty of room to hold the adventures ahead.

 
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
A web service (http://en.wikipedia.org/wiki/Web_service) is a software related technology that facilitates machine-to-machine interaction over a network. This article helps beginners in creating and consuming a web service using the ColdFusion Ma…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

21 Experts available now in Live!

Get 1:1 Help Now