Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Refresh ModalDialog window

Posted on 2004-08-12
11
Medium Priority
?
690 Views
Last Modified: 2010-05-18
Hello, I am using a ShowModalDialog command to open a popup window.  This window is populated with data from a table, using SQL queries.  However, recently I have decided to add buttons which can add or delete records shown in the window from the database.

While I can add or delete said records, I run into a problem: Changes made to the underlying table are not reflected in the window.  To solve this, the simplest solution is to just reload the window (as if it were just opened again, as there are no other possible changes to enact except for those to the underlying table).  However, a window.location.reload statement does not seem to work.

How does one reload or refresh a Modal Dialog box?
0
Comment
Question by:Alarming
[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
  • 6
  • 4
11 Comments
 
LVL 36

Expert Comment

by:Zyloch
ID: 11786049
Hi

Unfortunately, modal dialogs were made for display-only. The only way is to load your contents in a hidden iframe and then replace the contents in the modal dialog box with the new contents.

Regards,
Zyloch
0
 
LVL 1

Author Comment

by:Alarming
ID: 11787190
How difficult exactly would that be to do in general?  I'm not particularly keen on using an iFrame setup, and moreover the window could require a number of dynamic changes.  (Basically adding, editing, and deleting files via other modal popups from the page).

I suppose that means it might be necessary to make the page just a standard popup, but that creates an issue.  Currently the reason for the modal popup is so that a parameter can be passed denoting a given project (whose subrecords are then displayed).  These project names have a pretty loose format (commas, spaces, and other special characters are allowed) so they're not very easy to put in as query strings- and right now the setup is on a network share and not a server, so server side variables are out.

So then, I suppose follow up things: How flexible is the iFrame setup?   And is there a way to pass parameters efficiently to some standard popup window in a similar way as one can to a Modal Dialog box?
0
 
LVL 36

Accepted Solution

by:
Zyloch earned 400 total points
ID: 11787569
Passing them to popups is actually very easy. Just put the variable in your main window like this:

<script language="javascript">
<!--

var wouldBeQueryString = "fjsoi  some space3189047980#*(@&$#@(*????";

// -->
</script>

Then, in your popup window, you'd get the query string by doing:


opener.wouldBeQueryString;
0
Looking for a new Web Host?

Lunarpages' assortment of hosting products and solutions ensure a perfect fit for anyone looking to get their vision or products to market. Our award winning customer support and 30-day money back guarantee show the pride we take in being the industry's premier MSP.

 
LVL 4

Expert Comment

by:reggi635
ID: 11787951
window.location.reload defnitely won't work.

Try using

window.location.href = 'sameTemplatename followed with required parameters as URL string'

Its basically calling the same template with a redirect. Looks like a reload.

Hopefully this may help u

REGGI
0
 
LVL 1

Author Comment

by:Alarming
ID: 11796217
Well, the href and open commands don't work either, I probably should have mentioned that Reggi.

Basically I'm switching over to a standard popup that will sort of emulate the format of the modal dialog.  However, Zylock, for some reason the opener command doesn't want to work.

Right now I'm trying to make the statements as "window.opener.pass_recordname" (where recordname is set in the parent window function that makes the popup.

However, it gives me an error "object doesn't support" etc etc.  From looking at the opener documentation, it seems to state it's only supposed to be used for an iframe or a frame.  I'd prefer to leave the function a bit loose to just go to the parent, but if I need to I suppose some method of just naming and referrencing the window by hard code might be effective too.
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 11850518
Actually, opener is more often used for parent child window relationships. You could being conservative for a test and make the pass_recordname variable not have a "_" in it. Also, make sure that in the main window, the stuff inside pass_recordname doesn't have doubled up quotes, like var s = 'what's up' that should be var s = 'what\'s up'

You can also try putting the alert(window.opener.pass_recordname) and see what happens.
0
 
LVL 1

Author Comment

by:Alarming
ID: 11936720
I think I've got the passing right (needed to make sure the opener variable was global), but another issue remains.  Basically I can get the stuff passed, but since the new window refreshes itself (which was its original advantage over the showmodal), I need some way to disable the parent window's ability to create more of those new windows while one is in use.

Basically, right now an issue occurs in that more than one project can be opened in a new window but they are both running off the same variable information.

So window A opens and sets the global variable Project to "A".  Then window B is opened, and sets Project = "B".  Now, when A tries to refresh and checks what Project equals, it displays the same information as Window B.  So then, I have to stop a second new window from being opened until the first is closed (which had previously not been a problem with the modal one, by definition).

Any advise?
0
 
LVL 1

Author Comment

by:Alarming
ID: 11936739
Right now what I'm trying is something which goes like:

dim fullview

If(IsNull(fullview) OR fullview.closed) THEN
   <don't let another window open>
ELSE
   fullview = window.open(<stuff>)
END IF

Unfortunately, fullview.closed always gives an error as it states that the object is not correct in some way ("object required").
0
 
LVL 36

Expert Comment

by:Zyloch
ID: 11959312
Are you combining vbscript with javascript?
0
 
LVL 1

Author Comment

by:Alarming
ID: 11966878
No, because that would require some pretty extensive passing and such.  I'm sticking with vbscript, which theoretically has a closed flag.
0
 
LVL 1

Author Comment

by:Alarming
ID: 11966960
I solved the issue of having to worry about it being open or not by just not opening the new window as a "_blank" and instead just making sure it was always going to one of the same name.  By that merit, it would always be replacing the original if a new one was opened, preventing conflicts and confusion.
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.

Question has a verified solution.

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

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

610 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