This topic is locked
[SOLVED]

 Popup that closes on save

2/10/2020 9:34:06 AM
ASPRunner.NET General questions
Pete K author

I have my app configured so that edit pages get opened in a popup. When opened from a standard list page, clicking on Save saves the record and closes the popup. I want to get the same behavior when opening the edit page from a custom button. I've tried opening the edit via a simple location.href and also using Runner.displayPopup(). The former opens the edit page in the current window (not unexpectedly) while the latter works but does not close the popup window upon save. How can I get this to work the same as when opening from the list page?

Pete K author 2/10/2020



https://xlinesoft.co..._in_a_popup.htm

Example #9


Thanks, Sergey. I actually tried that. It doesn't seem to work for an edit page.

Sergey Kornilov admin 2/10/2020

It should work, just make sure you are replacing everything Add related with Edit counterparts. Check if there are any Javascript errors.

Pete K author 2/11/2020



It should work, just make sure you are replacing everything Add related with Edit counterparts. Check if there are any Javascript errors.



I'm not sure what changes need to be made, beyond using the AfterEdit() event rather than AfterAdd() for the two lines of code that reference PageObject.
When I debug the Javascript, it appears the block of code is not getting executed after a save, even though proxy['saved'] is true. The third test, window.parent.popup, is undefined. See screen capture. Thanks for your help, Sergey.


One thing I did differently because I need to get the editid of the edit page, is to put the popup code in the clientafter button event, after getting the record id on the server. I don't think this makes a difference, but just in case, here is my code for the button:



Client Before [empty]

Server:
// Get ID of current record

XVar data = button.getCurrentRecord();

result["donid"] = data["DonationID"].ToString();

Client After:
// pop-up to edit page
var win = Runner.displayPopup( {

url: "/SickLeave/admindonations/edit?editid1=" + result["donid"],

width: 1000,

height: 1300,

header: 'Edit donation'

});


Sergey Kornilov admin 2/11/2020

Pete,
I don't think you are following example #9. It shows how to call displayPopup function:

window.popup = Runner.displayPopup(...)


while you do

var win = Runner.displayPopup(...)
Pete K author 2/12/2020



Pete,
I don't think you are following example #9. It shows how to call displayPopup function:

window.popup = Runner.displayPopup(...)


while you do

var win = Runner.displayPopup(...)



[Sheepish grin] Dang. You're right. I already had written that code before I saw the example and missed it when updating. So sorry. Thanks for helping me figure it out.