Link to home
Start Free TrialLog in
Avatar of gplemos071400
gplemos071400

asked on

pre-Sized POP UP Windows from a Form Submit button

I'm looking for a piece of code that will initiate a pre-Sized POP UP Windows from a Form Submit button. I have been able to make a pre-sized window pop up from a regualr link but What I want to do now is have someone choose an option from a dop down menu, click the continue form button and have an application page I made pop up in a window I presized. Anyone have this code or a link to a URL which shows how to do it. I know I can do a target=blank but I want to be able to manage what the pop up window shows (No address line, etc..)

Thanks for your help!





HERES THE FORM CODE:


<cfform METHOD="POST" ACTION="agents_app.cfm?main=#URL.main#">
<SELECT NAME="PLAN">
<OPTION VALUE="PLAN10">PLAN10</OPTION>
<OPTION VALUE="PLAN15">PLAN15</OPTION>
<OPTION VALUE="PLAN20">PLAN20</OPTION>
<OPTION VALUE="PLAN25">PLAN25</OPTION>
</SELECT>
<INPUT TYPE="submit" VALUE="Continue">

Avatar of cheekycj
cheekycj
Flag of United States of America image

<script>

function openWindow(frm) {
window.open ('yourpage.cfm', 'newWin', 'scrollbars=yes,status=yes,width=300,height=300')
frm.submit();
}

</script>

<form METHOD="POST" ACTION="agents_app.cfm?main=#URL.main#">
<SELECT NAME="PLAN">
<OPTION VALUE="PLAN10">PLAN10</OPTION>
<OPTION VALUE="PLAN15">PLAN15</OPTION>
<OPTION VALUE="PLAN20">PLAN20</OPTION>
<OPTION VALUE="PLAN25">PLAN25</OPTION>
</SELECT>
<input type="button" value="Continue">
onclick="openWindow(this.form);"
</form>

Now, you can also use OnSubmit event too.

CJ
Avatar of Yog
Yog

<script language="JavaScript">
Clicked=false;
function openWindow() {
    myWindowHandle = window.open('about:blank','myWindow','width=400,height=400');
}
</script>

<form name="myForm" action="agents_app.cfm?main=#URL.main#" target="myWindow" onSubmit="if (!Clicked) return false">
<SELECT NAME="PLAN">
<OPTION VALUE="PLAN10">PLAN10</OPTION>
<OPTION VALUE="PLAN15">PLAN15</OPTION>
<OPTION VALUE="PLAN20">PLAN20</OPTION>
<OPTION VALUE="PLAN25">PLAN25</OPTION>
</SELECT>
<input type="button" onClick="openWindow(); Clicked=true; setTimeout('document.myForm.submit()',500)" value="submit">
</form>

Avatar of gplemos071400

ASKER

cheekycj, you can see what your piece is doing at:
http://www.lemosnet.com/misc/agents_esaform2.cfm

I'm sure I must have fudged the code some, check out the source and you'll see what its doing. Its opening up a pop up window and also opening up a regular window of the same poge but its not passing the information needed via the POST so the form can work. Take a look and let me know if we can do anything with it?




Yog, I have set up your as well at:
http://www.lemosnet.com/misc/agents_esaform3.cfm

This one is not going to the next page like the above (its staying put like it should) but it is opening up the window, however it too is not passing the POST info from the form to make the form work. The form is looking for that PLAN number to decide what to display on screen.



I actually have a working version of what I need from someone else and you can view the code here:
http://www.lemosnet.com/misc/agents_esaform.cfm



I like the code you two gave me because it was short and sweet vs the link above that IS working, and working is all that matters I guess. Feel free to look at it and see if you guys get some ideas.

I would like to show the STATUS bar so I can see the "SECURE LOCK ICON" on the pop up window.

Man.. one day I really gotta just sit down and learn javascript much more detailed, ROFL...

Thanks for the help so far guys!
try this instead:
<script>
function openWindow(frm) {
window.open ('yourpage.cfm', 'newWin', 'scrollbars=yes,status=yes,width=300,height=300');
frm.target="newWin";
frm.submit();
}

</script>

<form METHOD="POST" ACTION="agents_app.cfm?main=#URL.main#">
<SELECT NAME="PLAN">
<OPTION VALUE="PLAN10">PLAN10</OPTION>
<OPTION VALUE="PLAN15">PLAN15</OPTION>
<OPTION VALUE="PLAN20">PLAN20</OPTION>
<OPTION VALUE="PLAN25">PLAN25</OPTION>
</SELECT>
<input type="button" value="Continue">
onclick="openWindow(this.form);"
</form>
cheekycj, look at the source code on:
http://www.lemosnet.com/misc/agents_esaform2.cfm
Look at the code and see if you think I have manipulated anything incorrectly if you would not mind. I great appreciate it.


When the pop up window comes up, it actually looks like it errors out first, then displays the page. WEIRD! Although it looks like it works, I am not comfortable with that quick display of an error page.
ASKER CERTIFIED SOLUTION
Avatar of cheekycj
cheekycj
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Right on cheekycj!
That does what I need.
Thanks to all for the help!
No Problem.  Glad I could Help.

Thanx for the "A".

Cheers,
CJ