Edit Profile Confirmation Dialog
When a user makes changes to their profile and tries to exit the page without saving their changes, the current confirmation dialog could be clearer. Screengrab of the current dialog attached.
I suggest changing it to something like "You have unsaved changes to your profile. Are you sure you want to leave this page?"
Related ticket #4209
#1 Updated by Boone Gorges about 3 years ago
- Assignee changed from Boone Gorges to Daniel Jones
- Target version set to 1.10
Dan, I'm assigning this to you because you recently built a custom confirmation dialog, and I'd like to be sure that any new dialogs we add are similar. It may turn out that you need to modify BP's JS to prevent it from firing its own beforeunload event; we run a fork of it (wp-content/themes/bp-nelo/_inc/global.js) so feel free to make whatever changes are necessary.
#2 Updated by Daniel Jones about 3 years ago
I think the change over to CAC Advanced Profiles has broken the confirmation dialogue entirely - nothing stops me from closing the page after I make some edits. I think it's because right now global.js is monitoring the form with ID "profile-edit-form", but the CACAP edit form is called "cacap-edit-form", and I think some other elements would have to change too. Should I just delete it entirely from global.js and add to bp-nelo's custom.js? Or change the logic right in global.js? Either way I think it'll be very easy to adapt what I did here for this use case: https://github.com/cuny-academic-commons/cac/commit/aedf11982ea076977b5d1ad6bc2f9cf579dd7595
#4 Updated by Daniel Jones about 3 years ago
Great! So I've hooked up a dialog just like the one we used on the message canceling to the cancel button on the profile editing. However - you can't actually do all that much with the beforeunload event. All you can do is return a custom string for the browser to display, and even that isn't used by some browsers. Firefox, for example, doesn't care what you return, it shows its own message. For Chrome and others I use "You have unsaved changes to your profile" since they already add the "Are you sure you want to leave" part. Here's the commit: https://github.com/cuny-academic-commons/cac/commit/27583da052d7c0da5df42f95c96e7ba5825edadd
Let me know if you think this works.