Be sure to checkout our newest add-on Reading Time Pro!

EE4 compatibility updates:

  • Publisher is EE4 and EE5 compatible, but it does not currently support the Fluid field (it's in the works).
  • Reel is EE4 and EE5 compatible, but it does not currently support the Fluid field.

Ticket: Relationship atom is erroneously populating an unrelated relationship field after saving

Status Resolved
Add-on / Version Bloqs 4.0.19
Severity
EE Version 5.1.3

Tim Murtaugh

Feb 25, 2019

I have a field layout with a Bloqs field in one tab, and a native relationship field in another tab.

When I select a blog type with a relationship field in it, things seem fine until I save, at which point the publish form loads with a value in an unrelated relationship field.

Observations:

1. It’s always the same unrelated relationship field.

2. It only seems to affect one bloq. It doesn’t matter which channel the bloq is pulling entries from.

3. I haven’t spotted any obvious correlations in field ID numbers or anything that leads me to a theory, but I’m sure I don’t know all the places to look.

#1

BoldMinded (Brian)

Feb 25, 2019

Can you provide screenshots or a video please?

Also if I login to your cp, where do I go? What channel and entry id do I edit?

#2

Tim Murtaugh

Feb 25, 2019

Sorry, should have given you a script:

1. After login, go to Create > News
2. Put whatever you want in in the Publish tab, then go to the Main Content tab and add a Byline block, selecting anyone from the list.
2b. Go to the Related Content tab and confirm that the Related Form field is empty.
3. Save.
4. After the publish form reloads, go to the Related Content tab, and you will see your Byline selection is now in there.

#3

BoldMinded (Brian)

Feb 26, 2019

I can’t replicate this. Have you tried creating a new channel with a Bloqs field and Relationship, or a new EE install to replicate the issue?

#4

Tim Murtaugh

Feb 27, 2019

Comment has been marked private.

#5

BoldMinded (Brian)

Feb 27, 2019

In my local dev environment.

#6

Tim Murtaugh

Feb 27, 2019

It doesn’t happen when I create a new channel with new fields.

The data isn’t saved to the unrelated relationship field until the entry is saved a second time.

Is it possible the JS that populates the Bloqs field is also targeting this other field? They have one thing in common, a value of “30” — the relationship’s hidden field has a name of “field_id_30[data][]”, and the Bloq hidden field in question, I think, has a name of “field_id_37[blocks_block_id_615][values][col_id_30][data][]”.

#7

BoldMinded (Brian)

Feb 28, 2019

That is a perplexing issue. Bloqs doesn’t do any special queries for relationship data, it just instantiates the Relationship fieldtype class and calls the same methods that Grid does to render the field. If “30” is the common denominator then it could be a bad query or regex somewhere… possibly in EE itself.

#8

Jarod Clark

Mar 04, 2019

So we’re actually seeing this exact same issue with a site we’re currently building.

It’s on EE 5.1.3 and Bloqs 4.0.19.

We have a bloq with a Relationship atom, and a separate Relationship field that is outside of bloqs.

In our case, each relationship field is restricted to separate channels. However, after saving the entry, the relationship field that is not part of bloqs has the entries from the bloqs field added to it, even though those aren’t even allowed in that relationship field.

We can delete the extra entries and save, and the correct data is saved. It’s just happening upon opening up the entry (which then causes the wrong data to be saved if someone doesn’t notice it and saves the entry).

#9

BoldMinded (Brian)

Mar 04, 2019

Jarrod, do your two fields share a similar ID number?

#10

BoldMinded (Brian)

Mar 04, 2019

I haven’t had a chance to dig into this yet but I’m wondering is the same thing happens in a Grid field if the IDs are similar.

#11

BoldMinded (Brian)

Mar 04, 2019

What about on the front end? Does the data appear correct for both fields?

#12

Jarod Clark

Mar 05, 2019

In our case, it’s the same as what Tim is seeing, except ours share the number 8 instead of 30. So this does seem like something in a Regex not working correctly in an edge case.

Frontend will work fine until we re-save the entry with the bad data. It’s only after re-loading the entry edit page that the wrong entries appear in the field, which if then saved will mess up the frontend.

#13

BoldMinded (Brian)

Mar 05, 2019

Thanks for confirming. I’ll setup a test case with Grid to see if it happens there too, and if it does, then this may not be a Bloqs issue. Either way, I’ll look into it.

#14

BoldMinded (Brian)

Mar 05, 2019

Jarod and Tim, I was just able to replicate the issue using Grid, not Bloqs. I do have Publisher installed, so if neither of you have Publisher installed then I can pretty confidently say this is a core EE issue and I’ll report it to EllisLab.

#15

Jarod Clark

Mar 05, 2019

We are not using Publisher, so yeah, this sounds like an EE issue.

#16

BoldMinded (Brian)

Mar 05, 2019
#17

BoldMinded (Brian)

Mar 05, 2019

Going to go ahead and close this. Thanks for reporting the issue, and sorry it’s a problem :(

#18

BoldMinded (Brian)

Mar 05, 2019

The quick fix for this is to probably manually change one of the column IDs in the database so they do not match anymore. I _think_ it would be to change the id column in the exp_blocks_atomdefinition’s table, and then update atomdefinition_id value in the exp_blocks_atom table to match the new value. Just pick a number that doesn’t match any other fields.

#19

BoldMinded (Brian)

Mar 06, 2019

Login to reply

Contact

For add-on support, please use the Support section. General inquries and pre-sale questions can be sent to support@boldminded.com.