Solved

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

Posted on 2003-10-21
12
303 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
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

Supports up to 4K resolution!

The VS192 2-Port 4K DisplayPort Splitter is perfect for anyone who needs to send one source of DisplayPort high definition video to two or four DisplayPort displays. The VS192 can split and also expand DisplayPort audio/video signal on two or four DisplayPort monitors.

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…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

626 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