Feature #2910

Warning on leaving edited issue/wiki page without saving

Added by Kaspars Sprogis about 5 years ago. Updated about 3 years ago.

Status:ClosedStart date:2009-03-05
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:UI
Target version:1.2.0
Resolution:Fixed

Description

I had already few times situations while posting quite large issues in redmine, i accidentally push something, go back or forward, or close tab and so i loose all my information, that i has been entering for let's say quite a long time and this situation is very upseting!!!

There is one solution right now, but it isn't good: Save issue time to time, BUT user that i had assigned to already got mail with issue content at my first save and if user doesn't come to redmine and starts developing by email content, this issue can be incomplete yet.

So one of two solutions would be great feature:

1) Javascript alert on leaving page if issue form has been changed or any data has been entered or change (This can be easily done by binding form.onchange property and on page unload check if form has been changed...)

2) Add new Status: "Draft" where nothing happens when user saves issue with this Status - no emails sent. Or maybe this can be handled in some other way. "Draft" checkbox, etc...

Maybe there are other solutions than i have missed. If there are any, let me know. Thanks.

textsave.js (1.41 KB) Mathias Fischer, 2009-06-24 18:40


Related issues

Related to Defect #1852: Use regular POST (non-ajax) for wiki preview Closed 2008-09-04
Related to Defect #9845: Changes to Wiki content are lost when using Back button Closed
Duplicated by Feature #2981: Prevent from leaving the page when in edit mode for issue... Closed
Duplicated by Defect #3298: When updating an issue, clicking a link destroys all my i... Closed 2009-05-05
Duplicated by Feature #4396: Ask user to confim exiting unsaved wiki page Closed 2009-12-14
Duplicates Feature #810: Warning when navigating away from editing a form Closed 2008-03-07
Duplicated by Feature #1888: Wiki saving Closed 2008-09-11
Duplicated by Feature #6043: Prevent from leaving unsaved "New Issue" page. Closed 2010-08-05
Duplicated by Feature #1250: Ask confirmation on PageLeave in wiki Closed 2008-05-17

Associated revisions

Revision 4900
Added by Jean-Philippe Lang about 3 years ago

Warning on leaving a page with unsaved content in textarea (#2910).

The warning can be turned off in the user's preference.

History

#1 Updated by Paul Rivier about 5 years ago

Hi,

both proposals seem reasonable to me.

For drafts, some models could act_as_draftable (issue, wikipage, ...?). This would allow to set a draft flag to true. Models set as "Draft" would not be accessible to other users. However, they could be listed and accessed by the author, maybe via the author "my page".

For JS, it is quiet common to see this type of alert on web applications, I think this can also do the job and is simpler. My vote goes for this one because it does the job and is not too intrusive into redmine existing code.

#2 Updated by Mathias Fischer almost 5 years ago

I wrote a small piece of javascript like in #2981 proposed, because some people urgently needed it in our company ;-)

Added the following line to the header of app/views/layouts/base.rhtml:

<%= javascript_include_tag 'textsave' %>

and the .js-file to public/javascripts/textsave.js

Perhaps anybody likes to test it?

#3 Updated by Kaspars Sprogis almost 5 years ago

Added textsave.js to our redmine. So far it seems working fine. Thanks a lot! :)
Will let you know if there will be any problems in the future.

#4 Updated by Kaspars Sprogis almost 5 years ago

Mathias Fischer wrote:

I wrote a small piece of javascript like in #2981 proposed, because some people urgently needed it in our company ;-)

There is one bug actually. Try following action sequence:
  1. Choose "New Issue"
  2. Change Tracker to "Feature" or any other (which is not default)
  3. Input subject and descriprion.
  4. Push "Submit"
    And after pushing SUBMIT warning alert shows, which shouldn't happen.

#5 Updated by Mathias Fischer almost 5 years ago

Yes, I can reproduce this bug. Guess there is an event triggered when changing the tracker. Other forms with onsubmit/onchange-Events have problems too, like the stuff_to_do-Plugin. Perhaps I can find a workaround...

#6 Updated by Mathias Fischer almost 5 years ago

The problem is the AJAX-Request on the site, so you would have to register the events again. But it is easier to put the following line in the initialize-function:

document.observe('submit',this.setUnchanged.bind(this));

But it does not work in IE6 :-(

And I would restrict the observedElements to textareas, because the selects have onchange-Events by themself.

#7 Updated by Randy Syring over 4 years ago

FWIW, I would like to see the draft option as well as a well implemented JS warning option. I would also like to see the draft option auto-save à la Gmail. That way, if your browser crashes, you hopefully have some of your work.

Personally, I think Gmail is a really good model for this type of thing.

#8 Updated by Mischa The Evil over 4 years ago

  • Category changed from Issues to UI

#9 Updated by Shane Pearlman over 4 years ago

+1 for getting the javascript alert pushed into the core. It has been a common tragedy,

#10 Updated by Nico van Dalen about 4 years ago

I would like to second the option to have a (good) javascript alert.

#11 Updated by Paulo Santos about 4 years ago

+1
This issue should be addressed as soon as possible, is not admissible users can loose all their work just this easy. Every week I get someone complaining about loosing their changes, and the only solution I can give them is... write everything outside Redmine first! This is extremely unproductive.

Also related, every Submit should request a confirmation... every now and then, everyone presses the wrong option by mistake, and there's way to correct it.

#12 Updated by Jean-Baptiste Barth about 4 years ago

Paulo Santos wrote:

+1
This issue should be addressed as soon as possible, is not admissible users can loose all their work just this easy. Every week I get someone complaining about loosing their changes, and the only solution I can give them is... write everything outside Redmine first! This is extremely unproductive.

I also used to say that to my users before I found this post. There is a script attached right here on this issue which prevents losing data, maybe you should try it. I admit it has side-effects, sometimes it is triggered while it should not (on Issues page when you have a filter for instance). But I'm nearly 100% happy with it for 6 months, and my users too ;-)

Also related, every Submit should request a confirmation... every now and then, everyone presses the wrong option by mistake, and there's way to correct it.

I disagree, there IS a way to correct it :
  1. it's not too complicated modifying your message after it has been published. OK the notifications were already sent, but you can edit it with "more" button or with the pen on the side of each comment
  2. I think it would be complicated to implement something "a-la-gmail" to allow people to stop sending an issue/comment X seconds after they pressed Enter key or pushed the button...

Anyway, I totally agree Randy's comment : I think Gmail is a really good model for this problem. I started implementing an autosave functionality as a plugin. I don't consider it as stable, but you can find it at github and try it if you want. I would be happy to have feedback or contributions on it. As I really need this functionality before may 2010, it will be released as stable before this date, maybe with the 2 functionalities (autosave + javascript).

#13 Updated by Paulo Santos about 4 years ago

The "Request confirmation on Submit" feature, is more like a simple popup message requesting "Are you sure you want to submit this?"... for flexibility, this feature could be an option in Project/Redmine settings, not a mandatory behavior.

As for the hack, I'll may give it a try... but I'm not comfortable making surgical changes to a SW installation, I would rather have a Redmine release with a final solution... otherwise I may end up needing a personalized Redmine repository to manage this small improvements B-)

#14 Updated by Daniel Netzer almost 4 years ago

I prefer the idea of a lightweigt JS solution over the heavier drafts implementation. I think this feature would add a lot of usability for many users and increase the acceptance of web-based software.

#15 Updated by Jean-Philippe Lang over 3 years ago

  • Target version set to 1.2.0

#16 Updated by Jean-Philippe Lang over 3 years ago

  • Subject changed from Warning on leaving edited issue page without saving or save issue as draft to Warning on leaving edited issue/wiki page without saving

#17 Updated by Fernando Hartmann over 3 years ago

+1 The two options are very useful.

#18 Updated by Fernando Hartmann over 3 years ago

I believe that #7066 can be a good implementation too.

#19 Updated by Fernando Hartmann over 3 years ago

I just realized that #2698 suggest auto save being minor-revisions, can be one option too IMHO.

#20 Updated by Jean-Philippe Lang about 3 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed

Feature added in r4900 base on Mathias' javascript implementation.
Only textareas are monitored and the warning can be turned off in user's preference.

Also available in: Atom PDF