Save models on popup close

  • 1
  • Question
  • Updated 8 months ago
  • Answered
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. 
Photo of Michael Schniepp

Michael Schniepp

  • 1,808 Points 1k badge 2x thumb

Posted 8 months ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,704 Points 20k badge 2x thumb
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.
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,040 Points 10k badge 2x thumb
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:

https://docs.skuid.com/v11.0.0/en/skuid/action-framework/action-sequences/#event-triggered-sequences

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. 
Photo of Gyan

Gyan

  • 1,400 Points 1k badge 2x thumb
Hi Michael,


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

https://community.skuid.com/skuid/top...



Gyan
(Edited)