`Field-set` inside `option-set` will wipe data on save (or preview)

Enonic version: 7.6.1
OS: Enonic Cloud

I have a content-type where there is an option-set with a field-set inside it. When I save (or just preview) in content studio some of the fields inside that field-set is removed, and the content is marked as changed.

If I remove the field-set from the XML everything works as expected.

Here is the code for the content-type:

<?xml version="1.0" encoding="UTF-8"?>
<content-type>
  <display-name>Article</display-name>
  <super-type>base:structured</super-type>
  <allow-child-content>true</allow-child-content>

  <form>
    <option-set name="contentType">
      <label>Article or Event</label>
      <occurrences minimum="1" maximum="1"/>

      <options minimum="1" maximum="1">
        <option name="article">
          <label>Article</label>
          <items>
            <field-set name="articleDetails">
              <label>Article Details</label>

              <items>
                <input name="thumbnailImage" type="ImageSelector">
                  <label>Thumbnail</label>
                  <occurrences maximum="1" minimum="0"/>
                </input>

                <input name="title" type="TextLine">
                  <label>Title</label>
                  <occurrences maximum="1" minimum="0"/>
                </input>

                <input name="preface" type="TextArea">
                  <label>Preface</label>
                  <occurrences maximum="1" minimum="0"/>
                </input>

                <input name="body" type="HtmlArea">
                  <label>Body</label>
                  <occurrences maximum="1" minimum="0"/>
                  <config>
                    <include>Strikethrough Subscript Superscript | Undo Redo</include>
                  </config>
                </input>

                <input name="reference" type="HtmlArea">
                  <label>Reference info</label>
                  <occurrences maximum="1" minimum="0"/>
                  <config>
                    <include>Strikethrough Subscript Superscript | Undo Redo</include>
                  </config>
                </input>

                <input name="articleDate" type="Date">
                  <label>Publish date</label>
                  <occurrences maximum="1" minimum="0"/>
                </input>

                <input name="articleTag" type="ComboBox">
                  <label>Select article's category</label>
                  <occurrences maximum="0" minimum="0"/>
                  <config>
                    <option value="projectweb">Projectweb</option>
                    <option value="report">Report</option>
                    <option value="publication">Publication</option>
                    <option value="job">Available positions</option>
                    <option value="news">News</option>
                    <option value="employee">Employee</option>
                  </config>
                </input>

                <input name="addedTag" type="TextLine">
                  <label>Add new categories</label>
                  <occurrences maximum="0" minimum="0"/>
                </input>
              </items>
            </field-set>

            <input name="showTags" type="ComboBox">
              <label>Show article's tag</label>
              <occurrences minimum="0" maximum="0"/>
              <config>
                <option value="report">Report</option>
                <option value="publication">Publication</option>
                <option value="job">Available positions</option>
                <option value="news">News</option>
              </config>
            </input>
          </items>
        </option>

        <option name="event">
          <label>Event</label>
          <items>
            <field-set name="eventDetails">
              <label>Event Details</label>
              <items>
                <input name="Location" type="TextLine">
                  <label>Location</label>
                  <occurrences maximum="1" minimum="0"/>
                </input>

                <input name="fromDate" type="Date">
                  <label>From Date</label>
                  <occurrences minimum="1" maximum="1"/>
                </input>

                <input name="toDate" type="Date">
                  <label>To Date</label>
                  <occurrences minimum="0" maximum="1"/>
                </input>

                <input name="time" type="TextLine">
                  <label>Time</label>
                  <help-text>Write the time of day for the event. For example: 09:00 - 16:00</help-text>
                  <occurrences maximum="1" minimum="0"/>
                </input>
              </items>
            </field-set>

            <field-set name="eventDescription">
              <label>Event Description</label>
              <items>
                <input name="title" type="TextLine">
                  <label>Title</label>
                  <occurrences maximum="1" minimum="1"/>
                </input>

                <input name="preface" type="TextArea">
                  <label>Preface</label>
                  <occurrences maximum="1" minimum="0"/>
                </input>

                <input name="body" type="HtmlArea">
                  <label>Body</label>
                  <occurrences maximum="1" minimum="0"/>
                  <config>
                    <include>Strikethrough Subscript Superscript | Undo Redo</include>
                  </config>
                </input>

                <input name="articleDate" type="Date">
                  <label>Publish date</label>
                  <occurrences maximum="1" minimum="0"/>
                </input>

                <input name="articleTag" type="ComboBox">
                  <label>Select event's category</label>
                  <occurrences maximum="0" minimum="0"/>
                  <config>
                    <option value="report">Report</option>
                    <option value="publication">Publication</option>
                    <option value="event">Event</option>
                    <option value="job">Available positions</option>
                    <option value="news">News</option>
                    <option value="employee">Ansatte</option>
                  </config>
                </input>

                <input name="addedTag" type="TextLine">
                  <label>Add new categories</label>
                  <occurrences maximum="0" minimum="0"/>
                </input>

                <input name="showTags" type="ComboBox">
                  <label>Show article's tag</label>
                  <occurrences minimum="0" maximum="0"/>
                  <config>
                    <option value="report">Report</option>
                    <option value="publication">Publication</option>
                    <option value="event">Event</option>
                    <option value="job">Available positions</option>
                    <option value="news">News</option>
                  </config>
                </input>
              </items>
            </field-set>
          </items>
        </option>
      </options>
    </option-set>

    <item-set name="newsdesk">
      <label>News info from Mynewsdesk</label>
      <items>
        <input name="mndId" type="TextLine">
          <label>myNewsDesk ID</label>
          <help-text>Do NOT edit this, we need it to sync correctly to My News Desk.</help-text>
          <occurrences maximum="1" minimum="0"/>
        </input>

        <input name="repoId" type="TextLine">
          <label>Repo ID</label>
          <help-text>Do NOT edit this, we need it to sync correctly to My News Desk.</help-text>
          <occurrences maximum="1" minimum="0"/>
        </input>

        <input name="thumbnailUrl" type="TextLine">
          <label>Thumbnail URL</label>
          <occurrences maximum="1" minimum="0"/>
        </input>

        <input name="lastUpdated" type="TextLine">
          <label>lastUpdatedString</label>
          <help-text>Do NOT edit this, we need it to sync correctly to My News Desk.</help-text>
          <occurrences maximum="1" minimum="0"/>
        </input>

        <input name="mainImageUrl" type="TextLine">
          <label>Main Image</label>
          <occurrences maximum="1" minimum="0"/>
        </input>
        <input name="mainImageCaption" type="TextLine">
          <label>imageText</label>
          <occurrences maximum="1" minimum="0"/>
        </input>
      </items>
    </item-set>
  </form>
</content-type>

Hi @tom

I couldn’t reproduce this. Used the exact same content-type descriptor you posted, selected one option, filled out all fields and saved. Nothing got lost, see persisted content below.

If you are saying that data disappears even on preview, it means that something else is going on elsewhere, for example in a page controller or a site filter, because preview by itself cannot cause any data changes but requests triggered by preview can.

Can you investigate what could cause the content update?

Strange thing is that the bug disappeared when I removed the <field-set> from the xml.

Yeah, I guess there’s something that goes wrong when the data is being saved but we should find out what causes the save in the first place. When I try it there’s obviously no preview for me at all, since it’s just a content type, which makes it hard to reproduce.