Home Forums Bug Reports issues related to field key references Reply To: issues related to field key references

  • Since this is one of the few topics about field key references, I’ll post what fixed it for me.

    If you have problems that seems to point to the wrong reference key being retrieved, make sure you don’t have a filed name duplicated SOMEWHERE ELSE.

    I know you probably triple-checked the fields failing to save the data to the right key, but that was what was mixing up my field values.

    I kept double and triple checking the field values and keys of the fields of the issue… I even fed the update_field function with the right keys, rather than field names, and it still failed, but I never thought to check OTHER fields from other subfields in other layouts (flexible content sub_fields).

    I really thought “if using the same name is so terrible, it would be plain prohibited, validated and auto-corrected if necessary”.

    My guess:
    When the keys are retrieved from the DB, and one is overwritten with the other in the array being generated, the indexes of the returned field keys don’t match the total fields and I assume that’s why the value for one field ends up in another, completely unrelated. It probably affects fields that were created after the one with the duplicated name.