Scenario: (webform 7.4) A multi page form with an address field on the second page, field has been saved and the form has been either submitted or saved as a draft. The submission (or draft) is viewed and the address field is there. The data in table {webform_submitted_data} shows as (I replaced my actual address for privacy):

a:6:{s:12:"thoroughfare";s:21:"MY ADDRESS 1";s:7:"premise";s:0:"";s:8:"locality";s:7:"CITY";s:19:"administrative_area";s:2:"MY PROVINCE";s:11:"postal_code";s:7:"MY POSTAL CODE";s:7:"country";s:2:"MY COUNTRY";}

Action: Attempt to edit the submission (or draft). Navigate to the second page of the form. The address field(s) are populated with the data as expected. If I then leave the edit form without saving, the address fields are wiped out except for the country, but that is because my default country value is set to CA.

Result: The address fields are wiped out when a draft or submission is edited but not saved. The data in table {webform_submitted_data} for the exact same field now shows as:

Array

I'm guessing that a step was missed here as it looks like the array wasn't converted back to text?

CommentFileSizeAuthor
#5 aft-draft_loss-2335693-5.patch599 bytesmarkie

Comments

thisisnotrealpeople’s picture

Errors in logs:

Notice: unserialize(): Error at offset 0 of 5 bytes in addressfield_tokens_webform_submission_load() (line 423 of /sites/all/modules/addressfield_tokens/addressfield_tokens.module).

thisisnotrealpeople’s picture

I commented out line 426 in addressfield_tokens.module:

//drupal_array_set_nested_value($submission->data, $parents, $addresses);

and it works now?

I am confused as to why this was happening in the first place. I tried to replicate the issue with a brand new webform and wasn't able to make the values disappear.

pcambra’s picture

markie’s picture

Priority: Critical » Normal
Status: Active » Needs review
StatusFileSize
new599 bytes

So looking at this function and the call, if the $addresses variable is empty, the resulting called function is sad that the value is set to an empty array. Created a small patch for your testing pleasure.

markie’s picture

Status: Needs review » Fixed

Went ahead and added this patch. Should be in the dev build soon.

  • markie committed d8ec8d8 on 7.x-1.x
    Issue #2335693 by markie, dbthorburn, pcambra, joe-b
    
    AddressField data...

Status: Fixed » Closed (fixed)

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