Page 1 of 1

submit to pop up

Posted: Mon Sep 27, 2004 3:12 pm
by neophyte
EDITED CAUSE IT GOT CUT OFF

I'm trying to figure out how to submit a form to a pop-up window.

I've got the pop-up window working like this:

<script language="JavaScript">
function openWindow(){
window.open('file.php', 'new_window', 'width=400, height=400');

} <form action="some.html" method="post" enctype="multipart/form-data" onSubmit="openWindow();" >

Does anybody know how to do this?

Posted: Mon Sep 27, 2004 3:16 pm
by timvw
i don't know what you mean with posting to popup window. (as data is posted to the server and not to windows at the client-side).

<form action="file.php" method="post">


If you want to display posted data in file.php, you might want to make sure you reload the file.php regulary (using js or http header)

Posted: Mon Sep 27, 2004 3:20 pm
by feyd
could pretty easily submit the page to itself, and add code to reload the popup..

or

use Javascript to slurp up the form data, and toss it into the popup inside a hidden form, submit that.

Personally, I'd go with the first option, if at all.

this worked

Posted: Mon Sep 27, 2004 3:53 pm
by neophyte
Hey this worked:

Code: Select all

<script language="JavaScript">
function openTarget (form, features, windowName) &#123;
  if (!windowName)
    windowName = 'formTarget' + (new Date().getTime());
  form.target = windowName;
  open ('', windowName, features);
&#125;
</script>
with this

Code: Select all

<form name="main" action="shizzle.php" method="post" enctype="multipart/form-data" onSubmit="openTarget(this, 'width=300,height=300,resizable=1,scrollbars=1'); return true;" target="newpopup" >
post goes to pop up