Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 770
  • Last Modified:

How to force a refresh/reload

Okay, this seemed easyin principle but I'm coming up stumped.

Start with a setup program in main browser window.  It's a bunch of buttons getting their color and text from a mysql database table.

Click button to edit it, open a popup window, selecting colr, typing text, etc.  

click submit button to submit form - onsubmit, close popup, run php program to save data to database table.

When done saving data, program calls original setup screen.

Problem is it doesn't redraw becasue it is already open and the save program was called from a different window.  Can't  use opener.location.reload(); because the opup is closed before saving data commences.

How the heck can I call the setup program to show the new changes upon returning from piopup window/save process?

tia
Owen
0
owenparker
Asked:
owenparker
  • 4
  • 2
  • 2
2 Solutions
 
ZvonkoSystems architectCommented:
You have to do two things:
1.) Give the window that needs a reaload a window name.
Like this:
<script>window.name="optwindow";</script>

2.) Open that window after update in popup response by sending this script as response:
<script>
var oW=window.open("","optwindow");
oW.location.reload(true);
self.close();
</script>

The trick is that window.open() method with an empty URL parameter will NOT change the actual URL nor will it load the target window. It will only fetch the reference to the named window.


0
 
owenparkerAuthor Commented:
Hi Zvonko

Where/how exactly do I run/load the script in number 2 above?  I figire it's probably evident, but I can't find a place to put it that it will 'work'

Thanks
Owen
0
 
ZvonkoSystems architectCommented:
"upon returning from piopup window/save process" you respond to the Popup window with the script in 2.)

After click on the Submit button you do NOT close the window but wait for the php response. The php response is ONLY the 2.) script text. The script will refresh the target window and close the popup window.


0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
Ray PaseurCommented:
Have you considered using an IFRAME?
0
 
owenparkerAuthor Commented:
Zvonko, I have tried to fiddle with your suggestion but am having problems.  I will detail what I have done and the results tomorrow.  Out of gas tonight.

Ray, I have never used iframes.  Could it give me the desired result?  I'm going to have to rethink this somehow if i can't get this to work.  There are a dozen other instances when I would need this exact same behaviour.  
0
 
Ray PaseurCommented:
Owen, if it were my application, I would go with the "rethink" strategy.  You don't have to write all that code to deal with pop-up windows (notoriously difficult cross-browser).  Just bring the data together in the setup window.  When someone clicks on a button to edit it, the top of the window is the button you want to edit - they do their edits and the action script saves the data into the data base, then reloads the original setup window.  You can do it all in one PHP script and the results will be a lot cleaner, less reloading, less confusing for the client, etc.

This is by no means the only way to accomplish the objective, but it simplifies the client interface, and I'm always a big fan of that! ~Ray
0
 
owenparkerAuthor Commented:
I do believe I might be getting caught up in trying to emulate other 'normal' windows apps too closely. I'm going to split the points to close this ticket, but for the record, the question/problem was not satisfactorily solved, but for now, that's... OK

Owen
0
 
owenparkerAuthor Commented:
Trying another direction...  Question not solved, but attempts worthwhile and advice was worthwhile...
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now