Avoid overwrite only first field with last value for fields with multiple values
Overview
Webforms with multiple emails values are not being saved correctly. The last submitted value is written to the first email field. Other emails are not being updated.
Before
-
Visiting the webform again we can see that first email was overwritten with last email
-
From the Admin UI it confirms what the webform was showing: first email overwritten with last email.
After
-
Repeat steps 1 to 4 from "Before" for initial data, filling the webform and saving.
Technical Details
-
Attaching exported webform with node export: webform-multiple-emails.txt
-
Site created for testing with civibuild using this command
civibuild create civi12 --type drupal-demo --civi-ver 4.7.27 --url http://civi12 --web-root /home/beto/buildkit/build/civi12
-
CiviCRM currently uses civicrm_webform 7.20, however this module was replaced with the last version found here https://github.com/colemanw/webform_civicrm
Comments
Base on the modifed code (shown below) this is probably not only applicable to emails but for fields which are not addresses.