Solved

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

Posted on 2003-10-21
12
301 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
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tomcat7  URL keeps resolving to https instead of HTTP 4 73
Autoresponder for Whole Domain in Plesk/Cpanel 2 94
System Analysis 5 64
exchange 2010 turning off 3des ciphers 2 434
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 …
What You Need to Know when Searching for a Webhost Provider
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

735 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