Save models on popup close

Hey All, 

I have a page with a popup where the contents of the popup are from a page include. What I would like to make is the ability to save model changes made in the popup upon clicking the ‘X’ close button at the top corner of the screen. Im guessing some JS will be needed but if anyone has any suggestions please let me know! Because the popup is a page include and links to another page I dont think the after close actions will work. 

Hmmm … not sure it’s possible since I’m not sure the actions are performed before or after the popup is closed. I think after and as such no interaction can happen with the models in the page include.

There’s a custom popup controller that disables Cancel to Close and Removes the X in the corner. That way only a button from the page include can close the popup. You can find it here. Barry Schnell made it I’ve used to learn about custom components ever since.

If you’re working in a newer version of Skuid, you might look into publishing events from one page to the other. This functionality was beefed up quite a bit starting in 11.0. See here for some documentation:

Perhaps the popup’s after-close action could be to publish a global event, and on the child page, have the event trigger an action sequence to save changes. I’m not sure if the included/child page will still be present to hear the event being published, but the general idea behind this is part of the reason Skuid added this into the product. 

I think Pat’s suggestion would work too - you could set up a button to close the popup instead of using the X, and perhaps hide the X with some CSS or the custom method he linked to. 

Hi Michael,

The following link might be useful for you. Just change cancel to save.…