If you happen to open a form that has a draft saved, unless you answer the "restore" option before the 'period' timer runs out, the old draft will be replaced with the values of the current form. In other words, if you take too long to decide if you want to restore the draft, the draft will be destroyed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

brandy.brown’s picture

I had this problem too. The problem is that the autosave module saves which vertical tab (at the bottom) is active. Therefore, it is incorrectly saving before a form truly becomes dirty. I just set the tabs to autosave-ignore and now it won't write over anything until a user truly makes the form dirty.

czigor’s picture

Priority: Normal » Major

I think this is a major issue. If the user cannot decide in 10 seconds, his saved form is gone. Instead of the present behavior the autosaving and also the editing of the form should be disabled until the user does not click either Ignore or Restore. What do you think?

@brandy.brown: Could you explain what you did to prevent this?

fabsor’s picture

We probably shouldn't change the default behavior of the module since it's stable and in it's current state it's dropping the message after 30 seconds which could be a "feature" for some people I guess.

This patch makes this behavior configurable, by letting you set the timeout time. Setting the timeout to 0, disables the feature completely. The autosave functionality won't kick in until the user has chosen something or if the timeout expires.

fabsor’s picture

Status: Active » Needs review
czigor’s picture

Thanks for the patch, at first try it does just what I need! I'll test it a bit more and get back here.

DamienMcKenna’s picture

Status: Needs review » Needs work

I think you have a mixup in the values - the PHP code refers to the timeout being in seconds but the JS doesn't convert it to milliseconds. I'd also wager that people would expect it to not remove the saved form data until told to do so, so it should default to 0 instead of 30.

czigor’s picture

Hi fabsor, are you planning to work on this or can I fix the points of Damien? I really need this feature on a project.

I have one more observation: the autosave_timeout variable should be removed in autosave_uninstall(). (Other autosave variables are handled in the patch in https://drupal.org/comment/8546657#comment-8546657.)

czigor’s picture

Status: Needs work » Needs review
FileSize
4.98 KB
2.28 KB

This patch adds the following:
1. Multiplies timeouts in seconds by 1000 to get milliseconds for setTimeout().
2. Sets the default timeout value to 0.
3. Cleans up the .install file.
4. Removes autosave_timeout on module uninstall.

czigor’s picture

Oops, that was multiplying too many times.

brandy.brown’s picture

I don't really see how this solves the problem of the node being overwritten prematurely which is the cause of this issue. The point is that the person should be able to restore until they change some value in the form (which vertical tab is active should not be included in analysis when determining whether a form is dirty or not).

czigor’s picture

@brandy.brown: The patch works this way: if the 'Autosave timeout' setting is 0 and there is an autosaved form found when loading the form then the autosave will not happen until the user clicks either 'Ignore' or 'Restore'.

czigor’s picture

Reroll. Also: restart autosaving whenever the Ignore/Restore popup disappears.

czigor’s picture

Status: Needs review » Fixed

  • czigor committed 282344b on 7.x-2.x authored by fabsor
    Issue #2179585 by fabsor and czigor: Draft disappears
    
brandy.brown’s picture

That still does not seem like an ideal solution to me. The autosave should always kick in once the form becomes dirty again. End users shouldn't have to pick ignore or restore to start the autosave process.

czigor’s picture

It's not always the case. For example I have a timer on my form which makes it dirty as soon as the form is loaded. But I get your point. What about making this an option? "Do not autosave while Ignore/Restore popup is shown."

azinck’s picture

I wonder if the autosave ignore/restore prompt should be some sort of modal or something that truly interrupts the editing process so that the user is forced to make the decision before they begin interacting with the form.

czigor’s picture

I have created a followup issue for this, see #2305011: Making the behavior of Ignore/Restore popup more obvious. Please share your ideas and use-cases there!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.