submit to pop up

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

submit to pop up

Post 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?
Last edited by neophyte on Mon Sep 27, 2004 3:17 pm, edited 1 time in total.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

this worked

Post 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
Post Reply