Solved

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

Posted on 2003-10-21
12
296 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
Comment Utility
Are you using cfmx?
0
 

Author Comment

by:jturkington
Comment Utility
yeah at the moment
0
 
LVL 9

Expert Comment

by:CFDevHead
Comment Utility
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
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 9

Expert Comment

by:CFDevHead
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Yeah, use GET and not POST in your forms.
Simple.
0
 
LVL 9

Expert Comment

by:CFDevHead
Comment Utility
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.

Join & Write a Comment

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…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

771 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

8 Experts available now in Live!

Get 1:1 Help Now