This topic is locked
[SOLVED]

Server event not happening after using Runner.Dialog

1/6/2024 7:34:10 PM
PHPRunner General questions
D
druck281 author

I am using a custom button to display a Dialog box (in ClientBefore event) which allows the user to select a person from a Dropdown list. The ID from that person is passed to the server event for some database updates. I populated the lookup array in the page BeforeDisplay event and the dialog box opens and displays the dropdown with the proper values. The problem is that when I click 'Select', the dialog box disappears and nothing more happens. I even left a popup message in the ClientAfter just to see if it's getting to that stage and that does not show. The ClientBefore code is as follows

return Runner.Dialog( {
title: 'Defer decision to another approver',
fields: [{
name: 'approver',
label: 'Alternate Approver',
type: 'lookup',
options: proxy['jsFLS']
}],
ok: 'Select',
cancel: 'Cancel',
beforeOK: function(popup, controls) {
var flsid = controls[0].val();
params["flsID"]=flsid;
}
});

Any idea what is preventing the Server and ClientAfter events from firing?

Thanks!

admin 1/8/2024

You need to return false.

Check the first note here:
https://xlinesoft.com/phprunner/docs/about_dialog_api.htm

D
druck281 author 1/15/2024

The examples show that return false is not necessary when returning the Dialog itself since the .dialog always returns false. Just for the sake of testing, I added

return false;

and still nothing happens beyond the Client Before.

Looking at the help article that you referenced, I noticed something. I was using Runner.dialog instead of ctrl.dialog even though I was calling it from a custom button. I switched it to ctrl.dialog and found that I totally lost the event and not even the Client Before executes that way. I have uploaded the project to the demo site and submitted a ticket so you can see exactly what is happening.

Thank you.

D
druck281 author 1/15/2024

With a little more digging, I was able to get this to work. The working code is posted below...

window.proxy=proxy;
var flsList = window.proxy['jsFLS'];

ctrl.dialog
(
{
title: 'Defer decision to another approver',
fields:
[
{
name: 'approver',
label: 'Alternate Approver',
type: 'lookup',
options: proxy['jsFLS']
}
],
ok: 'Select',
cancel: 'Cancel',
beforeOK: function(popup, controls) {
var flsid = controls[0].val();
params["flsID"]=flsid;
}
});
return false;