Trapping User Cancel

Posted on
Sat Jul 18, 2020 12:11 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Trapping User Cancel

We're looking for a way to make sure that a user wants to cancel a device config ui. Something along the lines of an "are you sure" popup. In other words, user clicks cancel (after making a change) and is presented with a "your changes will be lost" message. After seeing the message, allow cancel to process when they click cancel again (or include a yes/no option in the popup). I could swear that I've returned an error_msg_dict on user cancel before, but now I can't find it.

Is it possible to keep the config ui from closing when userCancelled==True?

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Jul 20, 2020 7:34 am
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Trapping User Cancel

To add a bit more detail, it seems that validateConfigUi() is not called when userCancelled is True, so in order to be able to trap a UI cancel, it needs to be done via closedDeviceConfigUi(). We've tried to return an errorMsgDict from there, but it seems to be ignored.

What we're looking to do is to have something like a 'showAlertText' window pop up when userCancelled is True.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon Jul 20, 2020 11:18 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Trapping User Cancel

I don't believe this is going to be possible given how it currently works. When Cancel is pressed the UI is going to close the window no matter what. The only thing that can cancel the window closing is the validate call which is only called when Save is pressed.

Image

Posted on
Mon Jul 20, 2020 12:17 pm
DaveL17 offline
User avatar
Posts: 6753
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Trapping User Cancel

Thanks Matt, I was afraid of that. Please consider this a feature request then. :D

It's a decently complex config ui, so we'll be very explicit that users will lose their changes if they select cancel.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests