Closed Thread Icon

Topic awaiting preservation: Popup Windows and CGI forms (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=8191" title="Pages that link to Topic awaiting preservation: Popup Windows and CGI forms (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Popup Windows and CGI forms <span class="small">(Page 1 of 1)</span>\

 
KARN
Bipolar (III) Inmate

From: North Bay, Ontario, CA
Insane since: Apr 2001

posted posted 05-29-2002 06:37

here's my page: http://www.fusedeffects.com/Stage-5/comments.htm

and what it does now is a guestbook and when submit it submits to a new page... how do i put it so that it submits it in a new page but in a popup window instead of the same browser ther...

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 05-29-2002 06:52

Try putting target="_blank" in the <form> tag.

KARN
Bipolar (III) Inmate

From: North Bay, Ontario, CA
Insane since: Apr 2001

posted posted 05-29-2002 19:34

but because my background will repeat on a normal page i need a popup that's 350x525 to keep everything looking good...

kuckus
Bipolar (III) Inmate

From: Berlin (almost)
Insane since: Dec 2001

posted posted 05-29-2002 20:28

A JavaScript popup window is what you need, and Puzgly's Window.Open Code Generator can produce the code for you.

kuckus (cell #282)

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 05-29-2002 20:39

As long as your form supports the get method something like this will work

<html>
<head>
<script language=javascript>

function submit_form(form) {

q_string = "";
f = form.elements;
for (i=0; i<f.length;i++) {
q_string += f[0].name+"="+ f[0].value+ "&";
}
// Put the path to the CGI here (same as the form action attribute);
urlstring = "/cgi-bin/mycgi.pl?";
urlstring += q_string;
form_win = window.open(urlstring ,'remote','location=yes,width=350,height=525');
return false;

}
</script>
</head>
<body>
<form action="/cgi-bin/mycgi.pl" onSubmit="return(submit_form(this))" method="post">
<input type="text" name="text1"><br>
<input type="text" name="text2"></br>
<input type="submit" name="nada" value="go">
</form>
</body>
</html>



.:[ The Tao of Steve ]:.
Be Desireless
Be Excellent
Be Gone
...................................

[This message has been edited by bitdamaged (edited 05-29-2002).]

KARN
Bipolar (III) Inmate

From: North Bay, Ontario, CA
Insane since: Apr 2001

posted posted 05-30-2002 01:40

okay, bitdamage... i think your script should work cept when the popup comes up it just opens the cgi like... mycgi?name=sdklfklsdjf and it's the form repeating... is there a way to put action=post or something in the script...

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 05-30-2002 03:11

nope this way only works if you can use the GET method.

POST is more complicated, you actually need to sorta build the form in the new window.
I gotta go for a run a grab some chow, I'll give you something for that once I get back.



.:[ The Tao of Steve ]:.
Be Desireless
Be Excellent
Be Gone
...................................

KARN
Bipolar (III) Inmate

From: North Bay, Ontario, CA
Insane since: Apr 2001

posted posted 05-30-2002 04:11

okay i'll wait... thank you

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 05-30-2002 06:25

All right this should work but it's not how I want to do this.
I don't have my JS book here at home though.

Anyone know how to dynamically create a form object (ala newImg = new Image() ?? I tried form1 = new Form but that didn't work. That method would be preferable to this method of writing to the page.

<html>
<head>
<script language=javascript>
function formswap(form) {
newWin=window.open('blank.htm','whatever','height=200,width=150');
nw = newWin.document;
nw.write("<form action="+form.action+" method="+form.method+">");
for (i=0;i<form.elements.length; i++) {
fe=form.elements[i];
nw.write("<input type=hidden name="+fe.name+" value="+fe.value+">");
}
nw.write("</form>");
nw.forms[0].submit();
return false;
}
</script>
</head>
<body>
<body>
<form action="http://www.bitdamaged.com/testpages/yoyo.php" onSubmit="return(formswap(this))" method="post">
<input type="text" name="text1" value="test1"><br>
<input type="text" name="text2" value="test2"></br>
<input type="submit" name="nada" value="go">
</form>
</body>
</html>
</form>
</body>
</html>


You can try this as is the php page on my site will just echo the text1 and text2 values.



.:[ The Tao of Steve ]:.
Be Desireless
Be Excellent
Be Gone
...................................

KARN
Bipolar (III) Inmate

From: North Bay, Ontario, CA
Insane since: Apr 2001

posted posted 05-31-2002 01:59

thanx a lot bit... you are truely amazing...

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 05-31-2002 02:21

Bit, you'd have to create a new HTML Form Element via the DOM... probably with createNode.

« BackwardsOnwards »

Show Forum Drop Down Menu