Home Forums Add-ons Flexible Content Field Inputs with same "name" is copied to other layouts


Inputs with same "name" is copied to other layouts

  • Hello there,

    I’ve noticed that on the Flexible Content module, if you have multiple layouts that use fields with the same name (not label, the actual name), sometimes, a value from “Layout 1” is copied to “Layout 2” which happens to have a field named “text”. There is no JavaScript that will automatically copy the value from one field to another, I’ve checked that.

    Anyone experienced anything like that? Any field name from different layouts should be completely independent one to another, even if they are named “title”, “text” etc.


  • In most cases the value from one layout should not effect the value in another layout, even if the fields have the same name. The reason for this is that fields are not stored under the field name when they are sub fields of a flexible content field. For example, let’s say there’s a flex field named “flex_field” and two different layouts both have a text field named “text_field”. If you create 2 layouts, one of each layout type the text fields for the first layout will be saved with the name flex_field_0_text_field and the text field in the second layout will be saved with the name flext_field_1_text_field

    There is only one instance that I can think of that would cause a value from one layout to effect another layout and it would take a specific sequence of actions to make it happen.

    1. layout 1 has a field with a field name that is duplicated in layout 2
    2. the duplicate field in layout 2 can be hidden with conditional logic
    3. two layouts are created, the first is layout 1 and the second is layout2.
    4. the field in the first layout is not hidden by conditional logic
    5. The field in the second layout is hidden by conditional logic
    6. the post is saved
    7. the first layout is deleted
    8. the field in the new first layout is still hidden
    9. the post is saved

    Under conditions and steps the value from the original first layout will appear in the second layout because it will not be replaced because the new field is hidden.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Inputs with same "name" is copied to other layouts’ is closed to new replies.