Download & Extend

Add greater specificity to the address field widget form wrapper ID

Project:Address Field
Version:7.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I've put an address field in field collection, the state section is missing after country changed.

Comments

#1

Status:active» needs review

Simple enhancement solve this.

AttachmentSize
1890962-0.patch 728 bytes

#2

Title:Address field form isn't refreshed well in field collection» Add delta to the wrapper_id to avoid dddress field form isn't refreshed in field collection

#3

Title:Add delta to the wrapper_id to avoid dddress field form isn't refreshed in field collection» Add greater specificity to the address field widget form wrapper ID
Version:7.x-1.0-beta3» 7.x-1.x-dev
Component:User interface» Code
Category:bug report» task
Status:needs review» active

I can't reproduce this issue. The state list updates just fine when using a multi-value address field inside a Field Collection (or just attached to a Node for that matter).

That said, it's still invalid HTML to have two elements on the page with the same ID. If you're truly experiencing collision issues on refresh, even this change would seem to be insufficient, because if you have two address fields on the form they'd presumably still have IDs that collided (two addressfield-wrapper-0, ...-1, etc.).

So the real question is - how do we ensure a unique wrapper ID? I suppose we can include both the instance name and delta value - that should get us most of the way there, though it's still feasible to have duplicates (i.e. if you had a multi-value field collection w/ an address field in it on the form).

Additionally, this patch should make sure field related data can be found in the $context array. It's not guaranteed to be there, because the same form building function can be used outside of the Field API.

nobody click here