How to prepare
* create "company" group type and a company node
* create "company-address" content type, configure it as group content of company, add addressfield with country choice
* configure company-address groupref field to prepopulate from url like node/add/company-address?og_group_ref=107&destination=node/107 (for debugging purposes we disable the prepopuolated field iństead of hiding it)

How it works
* verify that everything works fine as long as we do *not* touch addressfield country selector: groupref is prepopulated on add and edit

How it breaks
* add or edit company-address
* verify that groupref is prepopulated
* use country-selector dropdown (which triggers some ajax to change addressfield)
* hit "preview" and verify that groupref is "none"
* hit "save" and verify that groupref is empty

Comments

geek-merlin’s picture

Note: There is a halfway workaround, by activating "node" context we can fix this behaviour on content edit.

This workaround does NOT prevent things from breaking on content create.

jastraat’s picture

If you are using select for the default entity reference widget, try changing it to autocomplete.

BarisW’s picture

Issue summary: View changes

Same here, we use the entityreference_view_widget selector. When we select a node using the views modal, and submit the form, the OG context is lost when there are validation errors.