Submit to open up a popup window and carry through input data

Posted by zac on Stack Overflow See other posts from Stack Overflow or by zac
Published on 2010-04-15T18:44:47Z Indexed on 2010/04/15 21:23 UTC
Read the original article Hit count: 244

Filed under:
|

Hi,

I have a input box on one page that on submit opens a new page with a longer form and the first field is populated with what was entered from the previous pages input box. So on page 1 there is this code:

<form action="sign-up.php">
<input  type="text" name="email" value="sign up for email" onFocus="clearText(this)" onBlur="clearText(this)" style="float: left;">     
<input value='Submit' /> </form>

Then on the sign-up page the receiving form grabs the string out of the url

//<!-- Begin
function getParams() {
var idx = document.URL.indexOf('?');
if (idx != -1) {
var tempParams = new Object();
var pairs = document.URL.substring(idx+1,document.URL.length).split('&');
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split('=');
tempParams[nameVal[0]] = nameVal[1];
}
return tempParams;
}
}
var params = getParams();
// End -->

I would like to keep all of this functionality but it have it occur in a popup. I added this function to the submit:

function myPopup() {
window.open( "sign-up.php", "myWindow", 
"status = 1, height = 300, width = 300, resizable = 0" )

and the form becomes

<form>
  <input  type="text" name="email" value="sign up for email" onFocus="clearText(this)" onBlur="clearText(this)" style="float: left;">       
    <input  onClick="myPopup()" value='Submit' /> </form>

But it no longer appends the input data to the url string. Anyone have any ideas on how I can accomplish this?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about forms