[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

Form to New window

How can i set the size of a target window?
i have this;

<form action="a.asp" method="post" target="_new">


.........
.....
<input type ="submit">
<form>

But i cant seem to set the size of the new window.How can i maximise the new window?
Thanks for any help.
0
scorpio1975
Asked:
scorpio1975
1 Solution
 
DMNCommented:
You can create target window JUST BEFORE submitting form, using JavaScript like shown below:

<html>
<body>
<script>
function openTarget()
{
  w=window.open("about:blank","mytarget","fullscreen");
}
</script>
<form target="mytarget" onsubmit="openTarget(); return true;">
<input type="submit" name="submit">
</form>

</body>
</html>
0
 
scorpio1975Author Commented:
But how can i submit the form data to a.asp?
0
 
killertechCommented:
I think this may work.

<html>
<body>
<script>
function openTarget()
{
 w=window.open("a.asp","mytarget","fullscreen");
}
</script>
<form target="mytarget" onsubmit="openTarget(); return true;">
<input type="submit" name="submit">
</form>

</body>
</html>

killerrech
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
yas022100Commented:
You can use as part of URL Parameter something like..

<Form Name=frmInput Id=frmInput Action=a.asp Method=Post onSubmit=CheckIt()>
<Input Type=Text Name=txtInput1 Id=txtInput1>
</Form>

<Script Language=Javascript>
   function CheckIt()
   {
      frmInput.Action = 'a.asp?TextValue1=' + escape(frmInput.txtInput1.value)
   }
</Script>

By Including as part of Parameter, inside of a.asp you will say

<%

   sValue = Request.querystring( "TextValue1" )

%>

Instead Of

<%
   sValue = Request.Form( "TextValue1" )
%>

Does that make sense?
0
 
DMNCommented:
NOOOO!!!!!!!!!!!

To submit form to a.asp you should:

<html>
<body>
<script>
function openTarget()
{
 w=window.open("about:blank","mytarget","fullscreen");
}
</script>
<form action="a.asp" method="post" target="mytarget" onsubmit="openTarget(); return true;">
<input type="submit" name="submit">
</form>

</body>
</html>
0
 
killertechCommented:
DMN,
Your right, your code works fine, However, so does mine.
pretty cool..

see ya
killertech
0
 
killertechCommented:
You may also want to put a window focus() line in so that a.asp will come into focus if by chance it is already open.
Like so:

function openTarget()
{
w=window.open("about:blank","mytarget","fullscreen");
w.focus();
}
</script>

killertech
0
 
DMNCommented:
And you can set any window parameters in window.open call, like scrollable, status, tollbar etc.
0
 
puranik_pCommented:

        No comment has been added lately, so it's time to clean up this TA.
         I will leave a recommendation in the Cleanup topic area that this question is:

->    Accept DMN's comment as answer

         Please leave any comments here within the next seven days.
         
         PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
         
         puranik_p
         EE Cleanup Volunteer  

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now