I have a very specific situation where I run into problems with the Addressfield field that I need help with.
I have a node type that holds several fields (a.o. file/image fields) and one field collection that is set up as a multiple field. Within the field collection there is an addressfield field and some other textfields.
The issue is that when on the node edit form a user edits one or more of the file/image fields, on submit, the edit form is reloaded without any message whatsoever (not on screen, not in de log and not in the apache log).
It took me a long time (eventually by eliminating every possible cause) to figure out that it is the field_collection "multiple value" setup combined with the addressfield field that causes this behavior.
Specifically the next lines of code in the addressfield.module file creates the effect of the form reloading wihout any message:
function addressfield_standard_country_validate($element, &$form_state) {
// If the country was changed, rebuild the form.
if ($element['#default_value'] != $element['#value']) {
$form_state['rebuild'] = TRUE;
}
Somehow when a users changes a file field (which triggers the form to be rebuild) the $form_state['addressfield'] that is used in the addressfield_field_widget_form() is no longer filled with whatever was filled in before which causes comparison of the #default value and the #value to return TRUE.>
Commenting out the above code fixes the problem, so I was wondering what this piece of code is in there for?
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | addressfield-form_rebuild-1508162-6.patch | 606 bytes | tien.xuan.vo |
| #1 | addressfield-form_rebuild-1508162-1.patch | 684 bytes | ezeedub |
Comments
Comment #1
ezeedub commentedI got this as well. Removing this check worked for me, and I haven't noticed any adverse side effects.
Comment #2
ezeedub commentedchanging status
Comment #3
marty2081 commentedSince we fixed this in March by removing the check we haven't seen any adverse side effects either (or any answer here for that matter).
Comment #4
skesslerWas this committed to the dev branch? Thanks!
Comment #5
rogical commentedDid you apply the patch? I failed to apply it, seems the dev codes was behind of the release version.
Comment #6
tien.xuan.vo commentedUpdated the patch from #1 against 7.x-1.0-beta4.
Comment #7
jsibley commentedAny progress on getting this committed?
Thanks.
Comment #8
jurgenhaasSame issue here and removing that one specific test resolves the problems and no side effects have materialized (yet).
Comment #9
bojanz commentedPlease test the patch in #2222819: Check triggering_element before setting $form_state['rebuild'], it's less problematic.
Comment #10
marc delay commentedSorry, this seemed like a duplicate, but based on the closing reason for the other bug this is not. This one effects the proper expected results of a working system where the other one effects out-of-bounds functionality.
It does seem like the patch attached to the other issue is a much better place to start than just snipping out offending lines of code.
Comment #11
socialnicheguru commented