This topic is locked
[SOLVED]

 Button Code worked in 9.8 but not in 10.1

6/13/2019 7:22:59 PM
PHPRunner General questions
M
Melanie authorDevClub member

I have a button on a list page that works just fine in 9.8 but the same code will not work in 10.1. The server side just grabs the primary key of the row and executes a stored procedure. When I look at developer tools in Chrome I see this error when I fire the button:
VM40:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0

at JSON.parse (<anonymous>)

at Object.success (RunnerAll.js:365)

at j (loadfirst.js:1)

at Object.fireWith [as resolveWith] (loadfirst.js:1)

at x (loadfirst.js:1)

at XMLHttpRequest.b (loadfirst.js:1)
The server side code for the button is:
global $dal;
$record = $button->getCurrentRecord();
if ($record["Oid"])
{
$sql = "EXEC Process_hotel_res_request ";

$sql.= $record["Oid"];

$sql.= " ";

CustomQuery($sql);

}
Any help?

M
Melanie authorDevClub member 6/13/2019



I have a button on a list page that works just fine in 9.8 but the same code will not work in 10.1. The server side just grabs the primary key of the row and executes a stored procedure. When I look at developer tools in Chrome I see this error when I fire the button:
VM40:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0

at JSON.parse (<anonymous>)

at Object.success (RunnerAll.js:365)

at j (loadfirst.js:1)

at Object.fireWith [as resolveWith] (loadfirst.js:1)

at x (loadfirst.js:1)

at XMLHttpRequest.b (loadfirst.js:1)
The server side code for the button is:
global $dal;
$record = $button->getCurrentRecord();
if ($record["Oid"])
{
$sql = "EXEC Process_hotel_res_request ";

$sql.= $record["Oid"];

$sql.= " ";

CustomQuery($sql);

}
Any help?


OK duh - looked further and pulled up the buttonhandler.php and looked at the line in question and found this:
location.href='reply_add.php?email='+result["email"];
If I remove that line and save buttonhandler.php my code works - if I leave it in it doesn't and the details of the error above are:
<b>Parse error</b>: syntax error, unexpected '=' in <b>C:\Users\Documents\PHPRunnerProjects\hotel\output\buttonhandler.php</b> on line <b>656</b><br /> (which is the line above)
That line doesn't seem to be something I put anywhere?
Sorry all - found my issue - buttons that I had in 9.8 that I needed to delete in 10.1 - all good and working now!!!