Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I see various issues when using autosave with complex cck form; will try to post more info as i debug but for now just issues list:
GOOD: all fields seem to be captured in the autosave table correctly
Issues when coming back to edit a previously saved node:
- VIEW: some fields do not show the values from the table; they show as blank
- VIEW->IGNORE: or
- VIEW->RESET->IGNORE: somehow the value of one of the integer fields seems to get picked up as the new form_id and a new entry is now written to table with this integer value as the form_id (very strange).
more to follow
Comment | File | Size | Author |
---|---|---|---|
#2 | autosave_cck_fields.patch | 737 bytes | edmund.kwok |
Comments
Comment #1
liquidcms CreditAttribution: liquidcms commentedbehavior noted above is different for IE7 / FF.
- when VIEW and some of the fields do not show; more fields are blank under IE7 than FF
- when VIEW->IGNORE, only FF has issue of creating new bad entry in autosave table
Comment #2
edmund.kwok CreditAttribution: edmund.kwok commentedHi Peter,
Try the attached patch; it resets the value variable that is used to recursively go through the autosaved form hash variable to obtain a autosave cck field's value.
It would be good if you can export the cck content type you are using so I can test it and debug as well.
Edmund
Comment #3
liquidcms CreditAttribution: liquidcms commentedmore info.
I would guess the issues here are with the formHash function in jquery.field.js.
Using FF i observe 2 input fields on my form. the HTML for this looks like:
As i flip between VIEW and RESET Firebug does not show this html changing; however the first field (word count) flips between blank and having the correct value in it.
Also of note, the return value $this from the formHash function is different for these 2 values.
Word Count field: defaultValue=716, value=""
Char Count field: both defaultValue and Value field = 4380
Also of note, in $this at end of formHash $tis->form_id.value = 4380 (which is the value of character count field and is the form_id that get falsely used to create a new entry in autosave table.
so - certainly looks like issues with the formHash function - but at least it narrows down these issues quite a bit.
Comment #4
liquidcms CreditAttribution: liquidcms commentedlol.. ok.. i didnt see your post above with patch.. and i just emailed you the same solution... i set to null rather than ""; but same effect.
thanks, i'll do some more tests.. do you still want the cck export.. not sure how well that will work since 1. not sure i can export cck node defs (although that would be a useful thing to be able to do) and 2. the fields in question are dynamically calculated so without rest of code in place they won't work.
Comment #5
edmund.kwok CreditAttribution: edmund.kwok commentedptalindstrom and I have corresponded via email and confirm that the patch above does solve the problem. It is committed; feel free to reopen this issue if there are further testing indicates that the problem is not fixed.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.