- open a node (that has redirects)
- open the edit form
- make some changes to the text/fields
- delete a redirect in the vertical tab (before you save the node)
After deletion of the redirect you get redirected to the node edit form. But all changed content is lost.
I'd expect one of the following (the first one preferred):
- after deletion of the redirect, the unsaved content changes should be restored
- if the user has unsaved content, the redirect delete link should be disabled (with a note that there is unsaved content which should be saved first)
- if the user clicks on the redirect delete link, he should be warned that unsaved content would be lost
- each redirect has a checkbox and the user would have to check those redirects that he wants to delete; the node save button would start the delete
| Comment | File | Size | Author |
|---|
Comments
Comment #1
joachim commentedMarked #1800592: Deleting redirect on node form's URL Redirects tab loses node edits as a duplicate.
Comment #2
joachim commentedThis affects adding, editing, and deleting redirects from an entity form -- updating title.
And I don't think there is a way to fix this with the current functionality. You'd have to submit the form in some way to save all the form data the user entered, keep that in some way, and restore it when the user returns to the form.
I'm scratching my head over how to do that -- form cache? or serialize the whole of $form_state['input'] in the query string???
Even if either were doable, it's really something that FormAPI should be providing for everyone -- not a wheel we should be inventing here.
So I think the best thing to do here is to change those links from having a redirect query to opening in new windows. The workflow is not as nice, but at least no input is lost!
Comment #3
joachim commentedHere's a patch with that change.
Comment #5
joachim commentedAdmittedly I was lazy and the patch is on the latest release rather than HEAD, but I have just tried applying it myself to HEAD and it applies fine:
Maybe testbot is less tolerant of fuzz?
Here it is again on HEAD.
Comment #7
chris matthews commentedThe patch in #5 no longer applies to 7.x-1.x-dev and probably should not be re-rolled since it's so old, but should be able to be easily re-created if this issue still applies.
Comment #8
dwwYup. Still true in D8. At least in D8 there's a cryptic warning about it. ;) Seems like
target = _blankwould be better than what we have now. The 'Add a URL redirect to this %type' link we're adding at #2958635: Restore link to add a redirect on node edit forms uses this, so as not to lose data.I think some inline entity management (via ajax) would be way better than all of this mess. I doesn't see why we have to invent any wheels (core or here) trying to save and restore form state on the node form. Let's just let content admins twiddle the related redirect entities directly via AJAX, ala inline entity form. It's not exactly a parent entity and referenced children entities, but it's functionally equivalent: we want to be able to tweak related entities while mucking with a "parent" entity.
Comment #9
dwwAdding #2931770: Improve usability of redirect operation links in node form as the related issue for doing this more slickly via AJAX (or potentially a modal).
I think I vote for making these operation links all use target _blank for now (since that'd be pretty quick/easy), and then use #2931770 for aa better (but longer-term) solution.
Cheers,
-Derek
Comment #10
berdir> I think I vote for making these operation links all use target _blank for now (since that'd be pretty quick/easy), and then use #2931770 for aa better (but longer-term) solution.
+1.