...

View Full Version : HowTo post form using text link to popup window & resize popup



efeller
01-17-2004, 05:44 AM
Please, someone help....this is what I have and it isn't working. The form will post, it will open the popup window, but it will not honor the width, height and scrollbar commands. Any Advice?

<head>
<script>
function formpopup()
{
window.open('about:blank','formWin','width="435",height="285",scrollbars="no"');
return true;
}

</script>
</head>

<body>
<form name=myform action="user.asp"
method="get" target="formWin"
onsubmit="return formpopup()">
<input type="hidden" name="userid"
value="1">
<p><a href="javascript:document.myform.submit();">Submit Me</a></p>
</form>
</body>

Murdz
01-17-2004, 06:46 AM
Firstly, you have used the quotes wrong. Secondly, there is a problem with the a href and the onsumbit properties. Something like this should work:

<head>
<script>
function formpopup()
{
window.open("about:blank","formWin","width=435,height=285,scrollbars=no");
return true;
}
</script>
</head>

<body>
<form name=myform action="user.asp"
method="get" target="formWin"
onsubmit="javascript:document.myform.submit();">
<input type="hidden" name="userid"
value="1">
<p onClick="formpopup()">Submit Me</p>
</form>
</body>

Hope this helps

Murdz

efeller
01-17-2004, 07:27 AM
You gave really good advice, but it still isn't quite there yet. I made those changes, and when I click on the "Submit Me" text, it will open a window, the correct size, but the window is blank and is not displaying the proper URL....

Garadon
01-17-2004, 11:42 AM
Perhaps something like this?



<head>
<script>
function formpopup()
{
window.open("about :blank","formWin","width=435,height=285,scrollbars=no");
return true;
}
</script>
</head>

<body>
<form name=myform action="user.asp"
method="get" target="formWin"
onsubmit="formpopup();">
<input type="hidden" name="userid"
value="1">
<p onClick="document.myform.submit();">Submit Me</p>
</form>
</body>

efeller
01-17-2004, 03:11 PM
the asp page, also has code in it to display information from a database based upon the hidden userid field. With Garadon's script, it does this in a popup, but it still will not resize the popup. I have tried the following and it is working, but first it is loading in the popup a blank page (about:blank) is showing up in the title bar, then a few seconds later it is displaying the correct asp page with the userid field passed. I have tried removing the "about:blank" in the javascript, but that will not work. Still not sure if this is as clean as I can get this script or not?

<head>
<script>
function formpopup()
{
window.open("about:blank","formWin","width=435,height=285,scrollbars=no");
return true;
}

</script>
</head>

<body>



<form name=myform action="security.asp"
method="get" target="formWin"
onclick="javascript:document.myform.submit();">
<input type="hidden" name="userid"
value="1">
<p onclick="javascript:formpopup();">Submit Me</p>
</form>

</body>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum