You are trying to run PHP code in Javascript event. This code needs to be placed to Server event.
Thankyou for your reply Sergey.
Placing the code in the Server Event has indeed removed the error.
However, it is now like the code isn't being executed. I have tried several variations, and placed the code in different Events. What I have found is that, if I place the code in an event, say, in the Process Values event of the View page, it works fine - I assume because the $values array is passed to the event. (The code shown triggers the stored procedure every time I move to a new record, which is not what I want to happen, but is heartwarming to see that the procedure does what I want it to <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=81243&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> ).
function ProcessValuesView($values, $pageObject)
{
CustomQuery("CALL spUpdateDespoolComplete('" . $values["iddespool_list"] . "')");
}
However, in the Server event, am I right in thinking that the $values array are not passed to the Event, and therefore the input parameter for my stored procedure doesn't receive a value ?
(Below is the List page, button click event - this doesn't trigger the stored procedure.)
function OnServer($params, $result)
{
CustomQuery("CALL spUpdateDespoolComplete('" . $values["iddespool_list"] . "')");
}
I am simply trying to trigger the MySQL stored procedure when the user clicks my custom button on the List Page, on the current record. I feel I have missed something in the help file, or in how custom button events work.
I have tried passing information from the Client Before event to the Server event (as per the help file) but can't make it work, and I don't understand what 'params' & 'ctrl' do in this case.
I hope this makes my query a little clearer - I thank you in advance for any assistance you can provide.
Kind regards,
Craig Smith