This topic is locked

Api dialog not working

11/2/2024 10:52:55 AM
PHPRunner General questions
J
Jan author

Hi everyone, I want to put information from an api-dialog in a session variable. I use a custom button with the code below that doesn't work ( :( )
What am I doing wrong?

Clientbefore :

return ctrl.dialog( {
title: 'example',
fields: [{
name: 'text'
}
],
ok: 'save',
cancel: 'Cancel'
});
???? = params["text"]

server :

$text=$params["text"] ;
$_session["text"] = $text;
D
druck281 11/2/2024

You will need to retrieve the value of the input control and assign that to the param["text"]. Check out this part of the manual as it has a little more description...
[https://xlinesoft.com/phprunner/docs/about_dialog_api.htm#:~:text=representing%20input%20control-,controls%5Bn%5D.val(),-Get%20value%20of](https://xlinesoft.com/phprunner/docs/about_dialog_api.htm#:~:text=representing%20input%20control-,controls%5Bn%5D.val(),-Get%20value%20of)
In the manual, look at Example 2 and Note 4 further down the page.

Below is an example of a dialog box I have that allows the user to select an option from a dropdown. I don't know if my code is the most efficient since I am still pretty new to this but I declared a JS variable which accepts the input value then I assign that to the params["xx"] variable so it can be passed to the server event.

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;