This topic is locked
[SOLVED]

 open add page in pop up

5/30/2012 11:50:22 AM
PHPRunner General questions
author

I have some custom code within a button that redirects to an add page at the end. The add page has pop up turned on. How do I redirect to the add page and open it in a popup?
current code in button "client after"

location.href='email_add.php';
tried this but it failed "client after"

window.open('email_add.php','name','width=200,height=200');

7542 5/30/2012

Ok. solved with help from Cristian
The problem is that you cannot open an add page in pop up except on the page that you are on. So I could not open the email_add.php on the events_list.php in a popup from my button event. My solution was to join the tables and add events_add.php with the details from email_add.php

  1. in the after client button I added
    // redirect to events page

    location.href='events_list.php?add=yes';
  2. Retrieved php $_REQUEST in javascript by adding this in the before list page on list page
    if ($_REQUEST["add"] == "yes")

    {

    $add = "<script> window.add = 'yes';</script>";

    $xt->assign("custom_xweb4",$add);

    }

    else

    {

    $add = "<script> window.add = 'no';</script>";

    $xt->assign("custom_xweb4",$add);

    }
  3. added the code to redirect to add page in javascript on load on list page
    if(add == "yes")

    $("#addButton"+pageid).click();
    Remember you then need to unset the php variables on the before add and add the data to the correct table in before add.
    Worked for me

C
cgphp 5/31/2012