By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,334 Members | 2,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,334 IT Pros & Developers. It's quick & easy.

What do I have to change to get this to work?

P: n/a
This works:

Main window:
<html>
<head>
<title>Untitled Document</title>
<script>
function openSub(){
window.open("Printwindow.htm","pw","height=200px, width=300px, left=300px,
top=300px")
}
</script>
</head>

<body>
<form id='form1' name="form1">
<input type="text" name="textfield">
<input type="button" name="Test" value="Test" onClick="openSub();">
</form>
</body>
</html>

Sub window:
<html>
<head>
<title>Untitled Document</title>
<script type="text/javascript">
function sendMe(txt){
opener.form1.textfield.value=txt;
}
</script>
</head>

<body>
<form name="frm">
<input name="btn1" type="button" onClick="sendMe('test');" value="Test">
</form>
</body>
</html>

but if I change the window.open to window.showModalDialog it doesn't work
any more. How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?

Thanks
iv**@tda.no
Jan 12 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
VK

Iver Erling Årva wrote:
How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?


By closing your ModalDialog. ;-)
var userChoice = window.showModalDialog(args);

Why do you think it's called "modal" and "dialog"? It is just
Microsoft's proprietary (though useful) way to display rich formatted
dialog windows. But by its nature and execution mechanics it's the same
as:
var userChoice = window.confirm('OK or Cancel?');

Jan 12 '06 #2

P: n/a
Iver Erling Årva wrote:
This works:

Main window:
<html>
<head>
<title>Untitled Document</title>
<script>
function openSub(){
window.open("Printwindow.htm","pw","height=200px, width=300px,
left=300px,
top=300px")
Should be ended with a semi-colon ...
}
</script>
</head>

<body>
<form id='form1' name="form1">
.... and is not Valid anyway.

<URL:http://validator.w3.org/>
[...]
Sub window:
<html>
<head>
<title>Untitled Document</title>
<script type="text/javascript">
function sendMe(txt){
opener.form1.textfield.value=txt;
}
</script>
</head>

<body>
<form name="frm">
It is much the same here.
<input name="btn1" type="button" onClick="sendMe('test');" value="Test">
</form>
</body>
</html>

but if I change the window.open to window.showModalDialog it doesn't work
any more.
In fact, it is rather surprising it already worked without that. For
window.open(), features in the third argument for window.open() are to
be comma-separated, not comma-space-separated.

<URL:http://docs.sun.com/source/816-6408-10/window.htm#1202731>
<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp>

And the syntax is different for IE-only window.showModalDialog(): the
features have to be separated by semi-colon there:

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp>
How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?


As was said, by closing it.
PointedEars
Jan 12 '06 #3

P: n/a
VK

VK wrote:
Iver Erling Årva wrote:
How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?


Actually check for showModelessDialog instead and
dlgObject.dialogArguments property
<http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodelessdialog.asp>

If you have more questions of their usage I guess they are better
suited for microsoft.public.scripting.jscript as not too many people
here ever used them actively (?)

Jan 12 '06 #4

P: n/a
>> How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?
As was said, by closing it.
The problem is that unfortunately closing it is not an option. The window is
generated by a program that opens a modal window and uses it to show a print
preview. If it is a big report, it can take long to display the first page
and I therefore want to send information back to the opener so it can
display some sort of progress status info while the report is being
generated. The good thing is that I have access to part of the code and
therefore could add code to send stuff back, but part of the code is an
active x and isn't mine. It is in that part the window is opened - hence I
cannot change the way it is done.

Iv**@tda.no


"Thomas 'PointedEars' Lahn" <Po*********@web.de> skrev i melding
news:14****************@PointedEars.de... Iver Erling Årva wrote:
This works:

Main window:
<html>
<head>
<title>Untitled Document</title>
<script>
function openSub(){
window.open("Printwindow.htm","pw","height=200px, width=300px,
left=300px,
top=300px")
Should be ended with a semi-colon ...

Yes, I know.
}
</script>
</head>

<body>
<form id='form1' name="form1">


... and is not Valid anyway.

<URL:http://validator.w3.org/>
[...]
Sub window:
<html>
<head>
<title>Untitled Document</title>
<script type="text/javascript">
function sendMe(txt){
opener.form1.textfield.value=txt;
}
</script>
</head>

<body>
<form name="frm">


It is much the same here.
<input name="btn1" type="button" onClick="sendMe('test');" value="Test">
</form>
</body>
</html>

but if I change the window.open to window.showModalDialog it doesn't work
any more.


In fact, it is rather surprising it already worked without that. For
window.open(), features in the third argument for window.open() are to
be comma-separated, not comma-space-separated.

<URL:http://docs.sun.com/source/816-6408-10/window.htm#1202731>
<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp>

And the syntax is different for IE-only window.showModalDialog(): the
features have to be separated by semi-colon there:

<URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/showmodaldialog.asp>
How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?


As was said, by closing it.
PointedEars

Jan 13 '06 #5

P: n/a
Iver Erling Årva wrote:
How do I send stuff back to the calling window if the callee has
been opened as a modaldialog window?
As was said, by closing it.


Please provide attribution of quoted material.
The problem is that unfortunately closing it is not an option. The window
is generated by a program that opens a modal window and uses it to show a
print preview. If it is a big report, it can take long to display the
first page and I therefore want to send information back to the opener so
it can display some sort of progress status info while the report is being
generated. The good thing is that I have access to part of the code
and therefore could add code to send stuff back [...]
It is nonsense to block the UA this long. So do not use a modal dialog
here, and modify the code so that it does not open one in the first place.
[Top post]


Please learn to quote.

<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1Post>
PointedEars
Jan 13 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.