This topic is locked
[SOLVED]

 Getting record keys with javascript?

10/25/2017 12:00:30 AM
PHPRunner General questions
K
keithh0427 author

I will start off by saying my strong suit is not Javascript.
So, I have a need to pass the record keys from the checked boxes on a list page to an external script.
I created a custom button for the list page and added the php code below to the "server" function of the button properties:
global $keys;

$arData = array();

while ( $data = $button->getNextSelectedRecord() ) {

$arData[] = $data["sacramentsID"];

}
$keys = implode(",",$arData);
$_SESSION["keys"] = $keys;
Next, I added location.href="somepage.php"; to the "client after" function per the instructions in the help guide. Once in the new page, I use the session variable and it does work.
What I would rather do is pass control to a new page using the window.open("anypage.php?keys="+keys);
Unfortunately, I have only been able to use this concept with the "client before" function of the button.
Is there a way to get the record keys from the selected checkboxes on the list page via javascript and then use them within the "client before" function for the custom button?