Autosubmit form to new popup window... how?
Posted on 2006-06-07
This one is going to be a tricky one and I hope someone here can help me...
I have a hidden form on my site that's designed to submit a couple of hidden fields to a PHP script via the "Post" method.
The php script is called "track.php" it's merely for tracking purposes after a visitor orders so that I know which of all my tracking programs is going to record the "sale".
Anyway, every time a customer orders, when they get to the "thank you" page, I have to ask them to "click here" to activate your product, which is really so that the from submits to a new window the tracking details.
I want to make it automated so that it all happens in the background without my customer knowing it. I already figured out how to "autosubmit" the form by using the following in the <body> tag: <body onLoad="document.form.submit()">
I already figured out how to have it open on a new window using this in the <form> tag: target="popup" onsubmit="window.open('', 'popup', 'width=100,height=100,scrollbars=yes,menubar=no,status=no');"
However, here is where the problem lies...
When you actually physically click on the form button, the popup window works and looks just like I want it to look, according to the specifications I placed above. BUT, when I add the "onLoad="document.form.submit()" on the <body> tag, the page that opens is a regular window... just like when you use the "target=_blank" command.
I'd like the window that opens to be to have no menubar or status bar, yet it contains everything.
Below is the whole code and if anyone here can figure out how to make the autopopup work correctly, please let me know.
========== Whole page ==============
<form name="form" action="track.php" method="post" target="popup" onsubmit="window.open('', 'popup', 'width=100,height=100,scrollbars=yes,menubar=no,status=no');">
<input type="hidden" name="tra" value="1">
<input type="hidden" name="amount" value="1.00">
<input type="image" src="invisible.gif" border="0" name="submit">
========== End Whole Code ===============
Anyway, can someone figure out how it can autosubmit but at the same time respect the attributes on the window.open command?