Posts: 145
Threads: 28
Joined: May 2018
Reputation:
12
Location: Netherlands
11-19-2020, 10:08 AM
(This post was last modified: 11-19-2020, 10:08 AM by jeroen.rottink.)
Sometimes I use WebApplication.ShowConfirm() to get a confirmation from the user. For example the user wants to delete a record from a grid and clicks on a icon to delete a row. The row index is sent to the server where additional information is gathered based on the row index. A message is crafted to display to the user and ask for a confirmation. For this step ShowConfirm(msg, callback, etc) is used. Can I pass additional event parameters to this callback? Now I keep state information in the object serverside but I would like to pass these parameters from the browser to the callback if possible.
Posts: 2,267
Threads: 199
Joined: Mar 2018
Reputation:
86
Location: Auckland, New Zealand
Hi Jeroen,
It should be possible with some minor modification and/or custom code. Unfortunately, the word "callback" in IntraWeb is used for multiple different concepts and sometimes it is not clear what you want to achieve.
First, let's make things clear about what is what regarding callbacks:
- We have a JavaScript callback (some code that is called when the user closes the dialog)
- and we have the Server callback method (some registered method in the server which is called via AJAX)
Also, just to have a better understanding of the requirement, there are 2 ways of using a callback when dealing with WebApplication.ShowConfirm():
1) The callback parameter refers to some custom JavaScript function. This function may or may not call the server again, etc. Basically you can do whatever you want with it.
2) The callback parameter refers to a Server callback method. In this case, this method will be called via AJAX when the user closes the dialog.
From your description seems that you want to pass some custom data from your own JS code to the server, as a parameter when (2) is being called. Is that so?