This topic is locked
[SOLVED]

Button Variables

8/21/2022 4:45:32 PM
PHPRunner General questions
C
clwp author

Hey Guys ... migrating an 8.x application to 10.x. It made heavy use of session variables which I see were deprecated in 9.x

I'm trying to get a custom button on a list page to execute an external script but cannot get arguments to pass thru.

I have a BeforeDIsplay event which is grabbing the proper data:
$userData = Security::currentUserData();
//print_r($userData["CustID"]);

The following commented code works perfectly, the uncommented does not:
//window.open('connector.php?Action=SyncOrders&CID=1','_blank');
//return;

var CID = $userData["CustID"];
window.open('connector.php?Action=SyncOrders&CID=' + CID , '_blank');
return;

Any perls of wisdom you can pass along?

Sergey Kornilov admin 8/21/2022

A few issues here.

  1. It made heavy use of session variables which I see were deprecated in 9.x - session variables continue working just the way the worked before. If you are talking about some internel PHPRunner session variables, now we provide an API instead of direct access to session variables.


  2. You are mixing PHP and Javascript code together and there is absolutely no way the same code worked in older version. In PHP events you need to use PHP code, in Javascript events you need to use Javascript code.



C
clwp author 8/21/2022

So how do I accomplish this?

C
clwp author 8/21/2022

Never mind ... just used a snippet instead.