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

Small independent window

P: n/a
Pat
I want to submit an HTML form and have the reply appear in a small
window that overlays the form window. After the reply is read, the
user should be able to delete the small window, and then directly view
the whole form and resubmit it if desired.

Stated a different way, I'd like the equivalent of a simple dialog box
that the CGI can write into.

So far, about all I've accomplished is to resize the browser window,
then the user has to use the Back button to return to the form, then
click the resize button to enlarge the form's window to a useable
size.

Help!

Pat
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Ivo
"Pat" <pm********@yahoo.com> wrote in message
news:fd**************************@posting.google.c om...
I want to submit an HTML form and have the reply appear in a small
window that overlays the form window. After the reply is read, the
user should be able to delete the small window, and then directly view
the whole form and resubmit it if desired.


Look into the target attribute of the form element:
<form target="_blank">

HTH
Ivo
Jul 23 '05 #2

P: n/a
Set it up like this:

<form method="POST" action="results.htm" target="resultsWindow"
onsubmit="return popResults();" name="popResultsForm">
[Form fields here]
</form>

<script>
function popResults()
{
resultsWindow =
window.open('','resultsWindow','toolbar=no,locatio n=no,directories=no,status
=no,menubar=no,scrollbars=no,resizable=no,screenX= 100,screenY=100,top=100,le
ft=100,width=500,height=500');
}

This will send your results to a small plain window that will appear in
front of the main window. results.htm is the file that will appear in the
popup window, add your form information handling to it. Add a close button
to the popup window:

<input type=button value=Close onclick="self.close();">

And you are all set.
"Ivo" <no@thank.you> wrote in message
news:40*********************@news.wanadoo.nl...
"Pat" <pm********@yahoo.com> wrote in message
news:fd**************************@posting.google.c om...
I want to submit an HTML form and have the reply appear in a small
window that overlays the form window. After the reply is read, the
user should be able to delete the small window, and then directly view
the whole form and resubmit it if desired.


Look into the target attribute of the form element:
<form target="_blank">

HTH
Ivo

Jul 23 '05 #3

P: n/a
Pat
"Simon Wigzell" <si**********@shaw.ca> wrote in message news:<dasuc.625930$oR5.12186@pd7tw3no>...
Set it up like this:

<form method="POST" action="results.htm" target="resultsWindow"
onsubmit="return popResults();" name="popResultsForm">
[Form fields here]
</form>

<script>
function popResults()
{
resultsWindow =
window.open('','resultsWindow','toolbar=no,locatio n=no,directories=no,status
=no,menubar=no,scrollbars=no,resizable=no,screenX= 100,screenY=100,top=100,le
ft=100,width=500,height=500');
}

This will send your results to a small plain window that will appear in
front of the main window. results.htm is the file that will appear in the
popup window, add your form information handling to it. Add a close button
to the popup window:

<input type=button value=Close onclick="self.close();">

And you are all set.
"Ivo" <no@thank.you> wrote in message
news:40*********************@news.wanadoo.nl...
"Pat" <pm********@yahoo.com> wrote in message
news:fd**************************@posting.google.c om...
I want to submit an HTML form and have the reply appear in a small
window that overlays the form window. After the reply is read, the
user should be able to delete the small window, and then directly view
the whole form and resubmit it if desired.


Look into the target attribute of the form element:
<form target="_blank">

HTH
Ivo

Simon & Ivo:

Thank you both for your responses. I'm sure your answers will solve
my problem, and teach me something new, too.

Thanks again,
Pat
Jul 23 '05 #4

P: n/a
Simon Wigzell wrote:
Set it up like this:

<form method="POST" action="results.htm" target="resultsWindow"
onsubmit="return popResults();" name="popResultsForm">
[Form fields here]
</form>

<script>
The "type" attribute is missing for valid HTML 4.
function popResults()
{
resultsWindow =
window.open('','resultsWindow','toolbar=no,locatio n=no,directories=no,status
=no,menubar=no,scrollbars=no,resizable=no,screenX= 100,screenY=100,top=100,le
ft=100,width=500,height=500');
}
Most of the features you specified with the third argument of window.open()
are the defaults as of "DOM Level 0". Furthermore, since your assignment
lacks the `var' keyword, you are creating an global not properly initialized
and unnecessary here until further notice. Then you hide scrollbars while
making the popup of fixed size which is clearly a Bad Thing, and return
*nothing* (i.e. the `undefined' value) from the method but return that
Nothing to the return value of the called method to the event handler
instead of returning a boolean value. So after all,

function popResults()
{
window.open(
'',
'resultsWindow',
'scrollbars=yes,resizable=yes,left=100,top=100,wid th=500,height=500'
);

return true;
}

would be far better than what you wrote.
This will send your results to a small plain window that will appear in
front of the main window. results.htm is the file that will appear in the
popup window, add your form information handling to it.
No, it won't. What you forgot to take into account is that the popup window
requires a certain time to get "open", to have memory allocated for its GUI.
But since Window is a host object, the script engine is not responsible for
that but the API of the UA is.

A better, yet untested approach would be to wait until the popup's document
object is accessible and then return `true' and, in turn, return true to the
event handler so that the default handler would be used, submitting the form
data.

function popResults()
{
var w = window.open(
'',
'resultsWindow',
'scrollbars=yes,resizable=yes,left=100,top=100,wid th=500,height=500'
);

if (w)
{
while (!w.document) ;
}

return true;
}

Probably the best way is not to use popup "windows" at all for form
submission. They may be blocked or filtered, and if the user wants
to review his/her inputs (s)he can use the Back feature (button) of
his/her UA anyway.
Add a close button to the popup window:

<input type=button value=Close onclick="self.close();">

And you are all set.
No, you are not, on the contrary. IIRC the timing problems that arise
with such an approach have been discussed several times before here.
[Top post]


<http://jibbering.com/faq/#FAQ2_3>
PointedEars
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.