Forums

Launch submit URL in a popup window?

cohncons 09 May, 2008
I'm trying to use a form to launch a hosted remote control tool.

The url for the remote control host works great in the Submit URL, but it changes the entire page to the remote control host. What I would like to do is have the remote control URL opened in a popup window and have the main form window go to my redirect URL.

Any suggestions?
GreyHead 09 May, 2008
Hi cohncons,

Add the code to open the popup in the 'OnSubmit after' box, this is executed before the main form redirects.

Bob
cohncons 10 May, 2008
Bob,

Thanks for the suggestion. I figured that's where I was going, and had hoped to get the quick three line, "here's how you would do it." But, the exercise in hunting down the answer was rewarding. B)

I now have the popup window working, but I have either uncovered a bug or I'm trying to do more than is possible.

If I put a redirect url in on the Form URLs tab or if I use mosRedirect (doesn't matter if I put it in the on submit before or after code blocks), then the redirects occur, but the popup doesn't launch. If I remove that redirect, then the popup fires properly.

It's not a big issue, because the redirect went to a simple, "Your remote session is launching." page and I just copied that HTML into the on submit -after block.

The first block is the code that launches the popup. I have it in my onsubmit - before block. The second code block in in on submit - after and just serves to keep the main browser window on my site without a blank content area.

I'm sure there's a more optimal way to build the window.open arguments string instead of opening and closing three PHP code blocks, but I needed to keep this simple until I got it working.


<script type="text/javascript">
{
<?php
require_once("libraries/joomla/utilities/browser_detection.php");

$url = 'https://www.fastsupport.com/';
$name = 'Cohn Consulting Remote Support Tool';
$status = 'status=no,toolbar=no,scrollbars=no,titlebar=no,menubar=no,resizable=no,width=800,height=480,directories=no,location=no';
$user_browser = browser_detection('browser');
if ($user_browser == 'msie7') {
    $name='_blank';
}
$param1 = '?name=' . $_POST['name'];
$param2 = '&supportSessionId=' . $_POST['supportSessionId'];
$url.=$param1 . $param2;
?>
window.open("<?php echo $url ?>","<?php echo $name ?>","<?php echo $status ?>");
window.focus("<?php echo $name ?>");
void(0);
}
</script>



[code]
<h2>Your remote support session has been launched.<br /></h2>
<p>Please answer 'Yes,' 'OK,' or 'Run' when prompted. </p><p>
This topic is locked and no more replies can be posted.