Solved

How to disable parent form when any popup form is open

Posted on 2009-05-07
11
1,814 Views
Last Modified: 2013-12-08
hi all ,

  I want to disable (Means i can not click on the window until and unless i close the pop up window ) the paraent window when my pop up window is open

 In my requirment i can not use model popup control provided by AJAX .

 I am using windows.open method to open the pop up menthod ,

I have tried the way given in one post

http://www.hscripts.com/scripts/JavaScript/disable-parent-window.php
http://www.thescripts.com/forum/thread521036.html

the method given here is fine but it is not allowing me to do any thing on the pop up also
 
In my pop up i have FileUpload control , so it is not allowing me to upload the File

Please suggest some way to do that.
0
Comment
Question by:spikyhappy
  • 6
  • 2
  • 2
  • +1
11 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24333805
0
 

Author Comment

by:spikyhappy
ID: 24334629
This solution is not useful in my case

 Please tell me , can i freeze the parent window till pop up is open ?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24335011
Not sure what you mean

If you want a modal solution you need something like I gave you or use the IE and FF3 only showModalDialog
0
 
LVL 8

Accepted Solution

by:
Bobaran98 earned 50 total points
ID: 24342298
I suggest you avoid any type of genuine popup and just go entirely with <div> tag formatting.  I could go into great detail explaining, but instead, just paste my code below into a fresh page and load 'er up!  I think you'll see immediately the possibilities in this kind of solution.

Note that this code is completely cross-browser compatible, working in:

Win - IE7
Win - FireFox
Win - Opera
Win - Chrome
Win - Netscape 6
Mac - FireFox
Mac - Safari
Mac - Opera
Mac - Netscape 6


<html>

<head>
 

<STYLE type="text/css">

   .fadeScreen {

		position:absolute;

		top:0px;

		left:0px;

		width:105%;

		height:100%;

		background:#FFFFFF;

		visibility:hidden;

		filter:alpha(opacity=50);

		opacity:0.50;

		-moz-opacity:0.50;

		-khtml-opacity:0.50;

   }

   .fadeScreenContent {

		position:absolute;

		top:0px;

		left:0px;

		width:105%;

		height:100%;

		visibility:hidden;

   }

   .modalWindow {

		width:300px;

		height:200px;

		background:#AAAAAA;

		border:1px solid #000000;

	}

	.modalWindowCell {

		text-align:center;

		vertical-align:middle;

		padding:20px;

	}

</STYLE>
 
 

<script language="javascript1.2">

	function popupVizToggle() {

		obj1 = document.getElementById('fadeScreen').style;

		obj2 = document.getElementById('fadeScreenContent').style;

		if(obj1.visibility == "visible") { 

			obj1.visibility = "hidden";

			obj2.visibility = "hidden";

		} else { 

			obj1.visibility = "visible";

			obj2.visibility = "visible";

		}

	}	

</script>
 

</head>

<body background="http://dl.img.qj.net/uploads/files_module/screenshots/253_PSP-background-thor64.jpg">
 

<input type="text" id="testText" value="Sample Element on Main Page" size="50"><p>

<input type="submit" id="testButton" value="Open Modal Window" onclick="popupVizToggle();">
 

<div id="fadeScreen" class="fadeScreen"> </div>
 

<div id="fadeScreenContent" class="fadeScreenContent">

	<table width="100%" height="100%"><tr><td valign="middle"><center>

		<table class="modalWindow"><tr><td class="modalWindowCell">

			Here's your so-called modal window.  Note that you can't click or select anything outside this "window" while it's visible!<p>

			<input type="submit" id="testButton2" value="Close Modal Window" onclick="popupVizToggle();">

		</td></tr></table>

	</td></tr></table>

</div>
 

</body>

</html>

Open in new window

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24342518
That looks good. Did you write this yourself?
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 8

Expert Comment

by:Bobaran98
ID: 24342583
Yep.  It's a simplified variation on something I designed a month or two ago... my company has a web-based reporting application that our clients use to access up-to-the-minute data... but unfortunately, some of the reports can take 10+ seconds to load because there are so many records getting pulled.  In some situations, some form elements would show when the page was only half loaded, and there was always this risk of clients clicking something early and causing JavaScript errors because the page wasn't loaded yet.  So that's why I created the half-opaque <div>, so the user could see what was happening on the page without being able to access any of it.  And then it was a simple matter to superimpose an animated "loading" gif to make it look more polished.

I'm glad you like it, mplungjan.  And on that note, I'll take your advice and go to bed... does that count has having a life?  :-)
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24342591
Sleep well. I am in CET so just got up 2.5 hours ago
0
 

Author Closing Comment

by:spikyhappy
ID: 31579323
This solution is very much useful
 thanks
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 24401418
@spikyhappy, not only do you only assign 50 points, but you also only give a "B" grade for a great solution. Can you please comment on the choice of grade?
0
 

Expert Comment

by:Nico2011
ID: 37724605
Hello - I like this, but need to do something similar with a form that can then add data into a DB - is there any way that can be done using your code please...?  I hve tried, but it doesn't look as if the parent page can be updated when the pop up is closed... Thanks in advance for any help you can give!
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37726079
Try changing
<input type="submit" id="testButton2" value="Close Modal Window" onclick="popupVizToggle();">
to

<input type="button" id="testButton2" value="Close Modal Window" onclick="popupVizToggle();location.reload(1)" />
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

708 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

16 Experts available now in Live!

Get 1:1 Help Now