473,504 Members | 13,830 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

form submission in a popup

Hi everybody,
what's the code for a form submission in a new window? i wasn't sure it it
should go in the form action tag, or in the submit button.
I tried something like this:
<form name="frmContact" method="POST"
action="javascript:window.open('send_email.asp',nu ll,'width=450, height=225,
status=no, directories=no, toolbar=no, location=no, menubar=no,
scrollbars=no, resizable=no');" onSubmit="return CheckForm();" >

but it don't work:
i 've a new window but no parameters + " [object Window] " write on the
first page

help,
please
Thanks
Jul 23 '05 #1
4 3342
Flex wrote:
Hi everybody,
what's the code for a form submission in a new window? i wasn't sure it it
should go in the form action tag, or in the submit button.
I tried something like this:
<form name="frmContact" method="POST"
action="javascript:window.open('send_email.asp',nu ll,'width=450,
height=225, status=no, directories=no, toolbar=no, location=no,
menubar=no,
scrollbars=no, resizable=no');" onSubmit="return CheckForm();" >


I could be wrong but I don't thnk it's possible to 'submit' to a different
window.

Easiest would be to have no submit, but have a button which opens the window
with a GET (I don't think javascript provides a urlencode function so you'd
need to write that too:

<script>
function sortOfSubmit()
{
var url='send_email.asp?';
url+='field=' + urlencode(form.field.value);
url+='&other=' + urlencode(form.other.value);
// ...
window.open(url,null,'width=450,
height=225, status=no, directories=no, toolbar=no, location=no,
menubar=no,scrollbars=no, resizable=no')

}
<input type='button' value='sort of submit' onclick='sortOfSubmit()'>
</script>

Alternatively open the popup with a form and javascript to copy over the
fields from window.opener, then submit itself.

HTH

C.

Jul 23 '05 #2
Flex wrote:
Hi everybody,
what's the code for a form submission in a new window? i wasn't sure it it
should go in the form action tag, or in the submit button.
I tried something like this:
<form name="frmContact" method="POST"
action="javascript:window.open('send_email.asp',nu ll,'width=450,
height=225, status=no, directories=no, toolbar=no, location=no,
menubar=no,
scrollbars=no, resizable=no');" onSubmit="return CheckForm();" >

Try adding target in your formdefinition:

<form action="bla.php" method="POST" target="myOtherWindow">

Of course, if you want myOtherWindow to have/have not scrollbars etc. etc,
you must create it first.
If not, a defaultbrowserwindow will open.

Regards,
Erwin Moller

but it don't work:
i 've a new window but no parameters + " [object Window] " write on the
first page

help,
please
Thanks


Jul 23 '05 #3
thanks
I 'm going to try it

"Colin McKinnon" <co**************@andthis.mms3.com> a écrit dans le message
de news: d0*******************@news.demon.co.uk...
Flex wrote:
Hi everybody,
what's the code for a form submission in a new window? i wasn't sure it
it
should go in the form action tag, or in the submit button.
I tried something like this:
<form name="frmContact" method="POST"
action="javascript:window.open('send_email.asp',nu ll,'width=450,
height=225, status=no, directories=no, toolbar=no, location=no,
menubar=no,
scrollbars=no, resizable=no');" onSubmit="return CheckForm();" >


I could be wrong but I don't thnk it's possible to 'submit' to a different
window.

Easiest would be to have no submit, but have a button which opens the
window
with a GET (I don't think javascript provides a urlencode function so
you'd
need to write that too:

<script>
function sortOfSubmit()
{
var url='send_email.asp?';
url+='field=' + urlencode(form.field.value);
url+='&other=' + urlencode(form.other.value);
// ...
window.open(url,null,'width=450,
height=225, status=no, directories=no, toolbar=no, location=no,
menubar=no,scrollbars=no, resizable=no')

}
<input type='button' value='sort of submit' onclick='sortOfSubmit()'>
</script>

Alternatively open the popup with a form and javascript to copy over the
fields from window.opener, then submit itself.

HTH

C.

Jul 23 '05 #4
Erwin Moller wrote:
Of course, if you want myOtherWindow to have/have not scrollbars etc. etc,you must create it first.
If not, a defaultbrowserwindow will open.


Creating a new window then posting to it creates challenges having
to do with the timing of the new window to accept input. I
struggled with that for a long time and finally arrived at the
solution of creating an interim page with an onload that submits
the opener form to the new window(in which the interim page
resides).

opener.document.THEFORMNAME.submit()

Lately I've been working on the concept of avoiding a post
completely by reading in the contents of the opener form from within
the new window. This seems to be a viable cgi-less / bandwidth
reducing alternative.

So far I found something interesting I'd like to share. There's
always more than one way to skin a cat and I've found, for some
reason, that reading in a form like this:

with (opener.document.THEFORMNAME) {
for (i=0; i < elements.length; i++) {
// processing occurs here
}
}

operates very much more slowly than this method:

for (i=0; i < opener.document.THEFORMNAME.length; i++) {
// processing occurs here
}

The iterations are the same so I wonder if anyone
here knows why there is such a performance difference?

Also, any similar tips will be appreciated.

Rob

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1745
by: Andi B | last post by:
Hi everyone. I have a quick question - if I have a form which refers to a javascript when its submitted using: <form name = "fred" onsubmit = "test()"> and this function creates a popup...
1
3748
by: Display Name | last post by:
the customer I'm developing a site for uses a canned form-parsing page that allows her to have an email subscription opt-in page add emails to a list she can manage using a link that you point your...
2
5757
by: Kimmo R. M. Hovi | last post by:
Currently I have defined: -- clip clip -- <form method="post" action="xx" enctype="application/x-www-form-urlencoded"> <input type="image" name="Function 1" src="image1.gif" border="0"...
2
1636
by: lmeng | last post by:
Hi, I am new to this Forum. Thanks in advance for any kind help. In the following HTML code, when I change the value of one text field then click "Modify" button, if the validation fails a...
1
5198
by: humbads | last post by:
I am trying to get a popup window to work for editing notes in my application. Here's how I implemented it: The original frame is called ORIGINALFRAME and contains a link like this: <a...
19
2875
by: Wouter | last post by:
Hi, I try to make when i send a <form> that he dont open a new window. Is there someone who know how i can make this whit javascript ? Greets Wouter
6
4360
by: Neil | last post by:
Hi, I have an aspx page with a number of web controls on it and one of these is a cancel button. I want to check the page to see if the user has changed any of the controls, i..e typed some text...
1
378
by: dave | last post by:
Hi all, I have a form that i would like to submit to a popup window but i would like all the javascript code in a function apart from the tickbox to submit the form, also at the start of the...
5
1897
by: kevinmajor1 | last post by:
Hello, all. I'm currently trying to write a script that will perform form validation upon submission. I know that more validation should be performed on the server's side...this is just a test to...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7298
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1526
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.