|
-
Aug 23rd, 2001, 10:25 AM
#1
Thread Starter
Frenzied Member
child windows, modal w/o being modal
I wish I could use a modal window but I can't because the window.opener only works in conjunction with window.open... nevertheless I need my child to act as modal. I tried to use a "onBlur="self.focus()"" method but the child has a select box that could not be accessed while using that. What I need to keep the user from giving the parent window focus. so my hypothisysed conclusion is to add a onFocus function to the parent window that checks to see if the child exists and if it does give the focus back to it... is this correct? and hints on how to do this or accomplish it another way?
Thanks in advance,
Michael
-
Aug 24th, 2001, 09:47 AM
#2
Thread Starter
Frenzied Member
I thought of a different way to go about it... on the form there is only a select, a submit button and a cancel button... with the self focus I mentioned previously the buttons still work just not the select so I have set the body-onBlur to go to a function and I think it should be something like:
function (get here if child blurs){
if (the select has focus){
}else{
self.focus
}
}
I just can't seem to word the if properly.. I have:
if(document.all.selDest.focused)
(selDest is the name of my select)
Thanks in advance,
Michael
-
Aug 24th, 2001, 01:08 PM
#3
Thread Starter
Frenzied Member
I tried using the "check to see if child is there and give it the focus" function but i cant figure out how to find the child. Code:
I'm opening the window with:
window.open('Profile_ImportMapping.asp','MapFieldsWindow', 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, left=' + intWidth + ' top=' + intHeight + ' width=250, height=110');
then I have my parent's body onBlur call this function:
function childBax(){
if (MapFieldsWindow){
MapFieldsWindow.focus();
}
}
I get the error "'MapFieldsWindow' is undefined"
Thanks in advance,
Michael
-
Aug 24th, 2001, 01:14 PM
#4
Fanatic Member
Try changing this line to:
var MapFieldsWindow = window.open('Profile_ImportMapping.asp','MapFieldsWindow', 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, left=' + intWidth + ' top=' + intHeight + ' width=250, height=110');
-
Aug 24th, 2001, 01:18 PM
#5
Thread Starter
Frenzied Member
still receive same error
michael
-
Aug 24th, 2001, 02:18 PM
#6
Frenzied Member
from your parent you have to do:
newWin=window.open('Profile_ImportMapping.asp','MapFieldsWindow', 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, left=' + intWidth + ' top=' + intHeight + ' width=250, height=110');
then your function
function childBax(){
if (newWin){
newWin.focus();
}
}
'MapFieldsWindow' is you new window title!!
but that won't put your window modal, it will just if the user return to the parent(opener), but if is what you want it will work!!
-
Aug 24th, 2001, 02:25 PM
#7
Thread Starter
Frenzied Member
that worked but created another small problem... if newWin is not present I get an error 
Thanks,
Michael
-
Aug 24th, 2001, 03:01 PM
#8
Thread Starter
Frenzied Member
(side question) is there an option to open a window without the minimize (-) and close (x) buttons at the top left corner? this script still lets the user close the parent... they cant focus it but they can close it...not good 
thanks in advance,
Michael
-
Aug 24th, 2001, 10:34 PM
#9
Fanatic Member
Here's something that may help. Of course it's an IE specific thing.
http://msdn.microsoft.com/library/de...odaldialog.asp
showModalDialog();
showModelessDialog();
-
Aug 24th, 2001, 11:20 PM
#10
Originally posted by msimmons
(side question) is there an option to open a window without the minimize (-) and close (x) buttons at the top left corner? this script still lets the user close the parent... they cant focus it but they can close it...not good 
thanks in advance,
Michael
you don't want your visitors to close your window? sorry if I took this wrong but I didn't read all this post. there is another thread in here tha tis asking that same question. we seen a window popup that didn't have a title bar. we asked how this is done. if you don't have an X or "_" you can still close it by alt + F4.
-
Aug 27th, 2001, 02:38 AM
#11
that worked but created another small problem... if newWin is not present I get an error
use it like this:
Code:
var newWin = 0;
...
newWin = window.open(...);
...
window.close(newWin);
newWin = 0;
the important part is that you ALWAYS set newWin to 0 if the window is not open, so that "if(newWin)" doesn't enter it's code block.
All the buzzt
CornedBee
-
Aug 27th, 2001, 10:32 AM
#12
Thread Starter
Frenzied Member
I tried that but still get the error.
The error I am receiving is:
the callee [server[not server application]] is not available and disappeared; all connections are invalid. the call did not exicute.
My code is:
var newWin = 0
function CHK_onclick(newVal, newVal2){
if (document.all.CHK[newVal].checked){
window.open('Profile_ImportCode.asp?Mode=Map&Count=' + newVal + '&TextField=' + newVal2, 'DoStealth3');
var intWidth = document.body.offsetWidth / 2 + 125;
var intHeight = document.body.offsetHeight / 2 - 75;
newWin = window.open('Profile_ImportMapping.asp?TextField=<%= TextField %>','MapFieldsWindow', 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, left=' + intWidth + ' top=' + intHeight + ' width=250, height=110');
}
}
and as for the side question of removing the min and close buttons. I figured it out... same as removing the title bar (or 'chrome'). This application is designed for not so computer savvy end users... if they know the f4 command then they know enought not to close the window in the middle of an import 
Thanks in advance,
Michael
function childBax(){
if (newWin){
newWin.focus();
}
}
thanks in advance,
michael
-
Aug 27th, 2001, 11:26 AM
#13
if you don't mind can you show us the remove titlebar code?
-
Aug 27th, 2001, 11:37 AM
#14
Thread Starter
Frenzied Member
Sure I copyied the idea from http://www.codelifter.com/main/javas...sspopup1.html.
just open your window with the option "fullscreen=1" then resize it & move it to where ever you want. I, personaly, don't like the way it looks and am working on some way to add the 'chrome' back... if you have anyideas let me know. another tip i just thought of... you have to open the new window inside a frame or you get a large null scrollbar on the right.
sample code:
importWin = window.open('pageURL.html','_Blank', 'fullscreen=1');
importWin.resizeTo(440,250);
importWin.moveTo(50,50);
-
Aug 27th, 2001, 11:46 AM
#15
Frenzied Member
i get an access denied on both line:
importWin.resizeTo(440,250);
importWin.moveTo(50,50);
what you're doiing different msimmons
-
Aug 27th, 2001, 11:54 AM
#16
Thread Starter
Frenzied Member
thats odd... here is my exact code (or you can check out the link i posted and see thier code):
function profileImport() {
var intWidth = document.body.offsetWidth / 2 - 220;
var intHeight = document.body.offsetHeight / 2 - 125;
importWin = window.open('Profile/Profile_ImportFrame.asp','_Blank', 'toolbar=0, location=0, directories=0, status=1, menubar=0, scrollbars=0, resizable=0, left=' + intWidth + ' top=' + intHeight + ' fullscreen=1');
importWin.resizeTo(440,250);
importWin.moveTo(intWidth,intHeight);
}
more on the 'adding chrome'
I am toying with adding two tables, one inside the other... ocellpadding & spacing. setting the page body tag to:
leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
and setting the style property of the table to:
style="PADDING-BOTTOM: 2px; PADDING-TOP: 2px; BORDER-TOP: 2px white solid; BORDER-LEFT: 2px white solid; BORDER-RIGHT: 2px white solid;"
I havent worked with it much but its a start in the right direction I think 
Michael
-
Aug 27th, 2001, 12:02 PM
#17
Frenzied Member
hmm, now i works,
that weird, cool tough!
-
Aug 27th, 2001, 01:49 PM
#18
Thread Starter
Frenzied Member
I wrote the code to add 'chrome'... here it is if anyone wants it:
(I am still getting the error that I posted on before if anyone has a solution to that )
first set your body tag to include:
leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
then add this table around you exisitng page:
<table cellpadding=0 cellspacing=0 width="100%" height="100%" border=0>
<tr height=2 bgcolor=#ffffff>
<td colspan=5></td>
<td width=2 bgcolor=#c0c0c0></td>
<td width=1 bgcolor=#000000></td>
</tr>
<tr height=2 bgcolor=#C0C0C0>
<td bgcolor=#ffffff></td>
<td colspan=3></td>
<td bgcolor=#ffffff></td>
<td bgcolor=#c0c0c0></td>
<td bgcolor=#000000></td>
</tr>
<tr height=2 bgcolor=#000000>
<td bgcolor=#ffffff></td>
<td bgcolor=#c0c0c0></td>
<td colspan=2></td>
<td bgcolor=#ffffff></td>
<td bgcolor=#c0c0c0></td>
<td bgcolor=#000000></td>
</tr>
<tr>
<td width=1 bgcolor=#ffffff></td>
<td width=2 bgcolor=#c0c0c0></td>
<td width=1 bgcolor=#000000></td>
<td>
**************
*your page here*
**************
</td>
<td width=1 bgcolor=#ffffff></td>
<td width=2 bgcolor=#c0c0c0></td>
<td width=1 bgcolor=#000000></td>
</tr>
<tr height=2 bgcolor=#ffffff>
<td colspan=5></td>
<td width=2 bgcolor=#c0c0c0></td>
<td width=1 bgcolor=#000000></td>
</tr>
<tr height=2 bgcolor=#C0C0C0>
<td colspan=6></td>
<td bgcolor=#000000></td>
</tr>
<tr height=2 bgcolor=#000000>
<td colspan=7></td>
</tr>
</table>
Michael
-
Aug 27th, 2001, 01:52 PM
#19
Frenzied Member
what is exactly your error now!!
-
Aug 27th, 2001, 02:00 PM
#20
Thread Starter
Frenzied Member
I am esentialy trying to produce a window that acts modal but cannot use the modal window function. I need the user to not be able to focus on the parent window. I added an onclick function to the parent to check if the child is present and if it is to give it focus. I used the code that you {Sebs} provided for this. It works fine (especially since I am using the 'chromeless' window) but if I do have the status turned on I get an error.
The error I am receiving is:
the callee [server[not server application]] is not available and disappeared; all connections are invalid. the call did not exicute.
My code is:
var newWin = 0
function CHK_onclick(newVal, newVal2){
if (document.all.CHK[newVal].checked){
window.open('Profile_ImportCode.asp?Mode=Map&Count=' + newVal + '&TextField=' + newVal2, 'DoStealth3');
var intWidth = document.body.offsetWidth / 2 + 125;
var intHeight = document.body.offsetHeight / 2 - 75;
newWin = window.open('Profile_ImportMapping.asp?TextField=<%= TextField %>','MapFieldsWindow', 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, left=' + intWidth + ' top=' + intHeight + ' width=250, height=110');
}
}
-
Aug 27th, 2001, 07:50 PM
#21
Fanatic Member
Is it possible the error is here:
'Profile_ImportCode.asp?Mode=Map&Count=' + newVal + '&TextField=' + newVal2
Is there a problem with any other ASP pages accessing the server?
-
Aug 29th, 2001, 09:31 AM
#22
Thread Starter
Frenzied Member
No, the error wouldent be there because it isnt trying to open the window its just checking to see if it is there... (code is a few posts up). When it is time to open the window it opens fine.
Thanks,
Michael
-
Aug 29th, 2001, 10:03 AM
#23
so you are getting that error on/in the child window that pops up?
or is the error in the parent?
-
Aug 29th, 2001, 10:08 AM
#24
Thread Starter
Frenzied Member
im getting the error in the parent when the child is not there and the parent looks to see if it is there or not.
psuedo code:
(parent body onclick)
look to see if child is present:
if present
give focus to child (this way I create the illusion of a modal window by not letting the user click on the parent while the child is open)
if not present
(do nothing) (... this is where i get the error, rather than do nothing it gives me a msg saying the child is not present...)
end if
thanks
michael
-
Aug 29th, 2001, 10:17 AM
#25
maybe I'm blind or just stupid but I don't see any code stating that if the child is not there do nothing. why would it check for the child if nobody clicked on the link to open the child?
-
Aug 29th, 2001, 10:29 AM
#26
Thread Starter
Frenzied Member
(parent script section)
var newWin = 0
function CHK_onclick(newVal, newVal2){
if (document.all.CHK[newVal].checked){
window.open('Profile_ImportCode.asp?Mode=Map&Count=' + newVal + '&TextField=' + newVal2, 'DoStealth3');
var intWidth = document.body.offsetWidth / 2 + 125;
var intHeight = document.body.offsetHeight / 2 + 100;
newWin = window.open('Profile_ImportMapping.asp','MapFieldsWindow', 'toolbar=0, location=0, directories=0, status=0, menubar=0, scrollbars=0, resizable=0, left=' + intWidth + ' top=' + intHeight + ' width=250, height=110');
}
}
(function that gets error)
function childBax(){
if (newWin){
newWin.focus();
}else{
}
}
(parent body tag)
<body onClick="childBax()">
the child opens and closes many times during the life of the parent, thats why I designed it this way.
Thanks,
Michael
-
Aug 29th, 2001, 10:37 AM
#27
how can you have a onClick event in the body that never gets clicked? I am not that keen on js so bare with me.
could you put after the else like exit;
also why don't you have a timer event in the child so that if the child loses focus it automatically goes back to it. I know this is possible because some sites I goto do this.
-
Aug 29th, 2001, 10:52 AM
#28
Thread Starter
Frenzied Member
Maybe it will help if I describe what I am doing and trying to not let the user do 
This is an import function that is part of a very large application. The user hits import on window a (we'll call it MAIN from now on) which opens window b (the parent we have been referring to in the previous posts we'll call it PARENT from here forward)
PARENT:
asks user for csv file to be imported, imports it, and reads the first line.
displays a table with the first lines values and a corresponding checkbox next to each.
when a check box is checked then the CHILD (same child from previous posts) is opened.
CHILD:
has a select box containing the possible destinations in the database that the selected value from the csv can go into.
the user selects the destination and the value is displayed on PARENT next to the value (to display the value dynamicly i have to use the call window.opener, which will only work if the CHILD is opened using window.open. If it were not for that I could use the modal window dialog and would not have this problem).
User repeats process of clicking checkboxes and assigning database destinations for each of the values they wish to import.
If the user has the CHILD open then clicks another checkbox on the PARENT then the arrays get crossed and everything is wrong from then on... the user has no business clicking on the parent anyway so I just give the focus back to the parent if they do... this all works fine when the CHILD is open. its just when the CHILD is not present and the PARENT is expected to do nothing that it tells me the child is not there.
hope that helped 
Michael
-
Aug 30th, 2001, 01:52 AM
#29
don't forget to set newWin to 0 if the child is closed, even if it is closed by clicking the X (I think you can do that by responding to ON_UNLOAD in the child and setting window.opener.newWin to 0
All the buzzt
CornedBee
-
Aug 30th, 2001, 08:54 AM
#30
Thread Starter
Frenzied Member
awesome! thank you!
michael
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|