Closed (fixed)
Project:
Autosave
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
16 May 2007 at 20:45 UTC
Updated:
6 Jul 2015 at 18:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Equinger commentedEXACTLY the same issue here. I'm not sure how complicated this is, but it would be huge.
Subscribing
Eric
Comment #2
mlncn commentedAnother option is to tell users to use Firefox, which usually maintains form text information even after a back / forward move.
Comment #3
Equinger commentedI hear that and it's definitely a good thought.
If only I had control of my users! It is a business where they use ie7 for some reason and are change averse. I can't believe how difficult it is to get people to get browsers and particularly one that's not IE (particularly among older users). I'm sure this is a problem that many of us have.
Eric
Comment #4
kaakuu commentedsubscribed
Comment #5
mlncn commentedEquinger: I agree that it would be best if the original request could be fulfilled, but i find even node autosave is not a surefire safeguard. Here is something that would give a bit of control over users:
http://drupal.org/project/dirtyforms
benjamin, agaric
(keywords: javascript warning when leaving text drupal)
Comment #6
sydneyshan commentedJust adding another vote for this feature. It's a great module - thanks for all the effort!
Comment #7
Crell commentedThe way the Drupal 7 version of this module works, it *should* be possible to do. I tried to keep such extension in mind when updating it. I do not have bandwidth to work on such a feature myself, but would accept patches.
I think what you'd need to do is add another branch to hook_form_alter for the comment form, and then introduce a branch of some sort to autosave_restore() for nodes vs. comments. (I don't think it can be done entirely generically.) The rest is just hooking up settings in the UI and such.
That said, the *only* reason to do this with an AHAH callback is for dynamic forms. For any form that doesn't change its structure in response to user input (the way "add more" fields work), this should be done using localStorage instead, completely client side. Comments, of course, are now in that first category in Drupal 7. Bah. :-)
Comment #8
czigor commentedAttached patch creates a textarea on the admin/config/content/autosave form to add form_ids to apply autosave to.
The patch tampers with the html id of the autosaved form so it might brake some existing css.
I don't know what happens if there are several forms on the same page to autosave but it probably won't work.
Comment #9
czigor commentedThis version removes the autosaved form on form submission.
Also, the patch from #2201317: autosave_node_presave() should be autosave_node_update() has been phased out.
Comment #10
czigor commentedBetter and general handling of $form_state['build_info']['args']. (This is needed e.g. on entity forms.)
Also fixing autosaved form removal on form submit.
Comment #11
czigor commentedPrevious patch works but has a huge security issue: the whole $form_state['build_info']['args'] array goes into the html. (Serialized, but still.)
So the proper way to do this is:
1. In autosave_form_alter() store $form_state['build_info']['args'] in the {autosaved_forms} db table in a new column (called 'args' for example).
2. In autosave_restore()
$form_state['build_info']['args'] = $record->args;Comment #12
czigor commentedPatch contains the suggested changes from the previous comment.
Comment #13
czigor commentedChanges relative to previous patch:
Comment #14
czigor commentedAdded an autosave.api.php file to document hook_autosave_prevent().
Comment #15
calebtr commentedThanks for this patch. I've tested it a little with the weebform module and with a custom form and it works well.
Comment #16
czigor commentedComment #17
czigor commentedMake forms autosaved before the update work after the update.
Comment #18
czigor commentedComment #20
czigor commentedFix hook_autosave_prevent_alter().
Committed.
Comment #22
matt.rad commentedHow do I get this to work for comments? I would like to try it out. Where can I find instructions for how to configure the module?
Comment #23
czigor commented@matt.rad Go to admin/config/content/autosave and add the form id of the form you want to autosave.
Comment #24
matt.rad commentedThanks a lot. It works perfectly.
For anyone else who might benefit be wondering, the module Devel Form Debug was an easy way to find form IDs.