Is field order relevant in structure field?

Thank you for the new Kirby5.
However, I have the impression that under Kirby5 in a structure field the order of the fields plays a role, for example if a required date field is bound to a toggle field via a when condition.

Enclosed are a YML file, a Screen Dump and a content file.

“info”: {
“kirby”: “5.0.0”,
“php”: “8.3.22”,
“server”: “nginx/1.25.4”,
“license”: “Unregistriert”,
“languages”: [
“de”
]
}

Best regards
Harald

title:
  de: Termine
  en: Dates and times

icon: calendar

fields:
  events:
    label:
      de: Veranstaltungen (neueste zuerst)
      en: Events (latest first)
    type: structure
    empty:
      de: Keine Termine
      en: No dates
    required: true
    sortBy: begindate desc

    columns:
      beginDate:
        align: right
        display: D.M.YY # Darstellung in Spalte (column) in Tabellen-Übersicht, sofern angegeben
        mobile: true
        width: 1/10 # Breite als Spalte (column) in Tabellen-Übersicht
      endDate:
        align: right
        before: "-"
        display: "D.M." # Darstellung in Spalte (column) in Tabellen-Übersicht, sofern angegeben
        mobile: false
        width: 1/10 # Breite als Spalte (column) in Tabellen-Übersicht
      eventTitle:
        mobile: true
        width: 1/5 # Breite als Spalte (column) in Tabellen-Übersicht

    fields:
      eventTitle:
        label:
          de: Titel der Veranstaltung
          en: Event title
        icon: title
        type: text
        required: true
        width: 1/3
        help:
          de: Eine aussage­kräftige Be­zeich­nung, oft reicht jedoch "Club-Abend"
          en: A meaningful name, but often "club evening" is enough
      gapTitle:
        type: gap
        width: 2/3


      # place field "isMultiDayEvent" here, to avoid errors during save, if isMultiDayEvent == true
      beginDate:
        label:
          de: Beginn-Datum
          en: Start date
        type: date
        display: D.M.YYYY # Darstellung in Anzeige eines Einzel-Events
        required: true
        width: 1/3 # Breite in Anzeige eines Einzel-Events
        help:
          de: Klicke auf Kalender oder auf Datums-Teil dann ↑↓ Tasten!
          en: Click on Calendar icon or on Date part then ↑↓ buttons!
      endDate:
        label:
          de: Ende-Datum
          en: End date
        type: date
        display: D.M.YYYY
        required: true
        width: 1/3
        when:
          isMultiDayEvent: true
      gapEndDate:
        type: gap
        width: 1/3
        when:
          isMultiDayEvent: false

      # if field "isMultiDayEvent" is placed here, field "endDate" will not be saved correctly
      isMultiDayEvent:
        label:
          de: mehrtägiges Event?
          en: multi-day event?
        type: toggle
        text:
          -
            de: nein
            en: "no"
          -
            de: ja
            en: "yes"
        width: 1/3
        help:
          de: Angabe eines Ende-Datums?
          en: Specification of an end date?

Title: Veranstaltungen

----

Events:

- 
  eventtitle: Demo
  ismultidayevent: 'true'
  begindate: 2025-06-20
  enddate: 2025-06-21

----

Uuid: 8xssvkhibvhmdtg6

No, the order is not relevant and the toggle itself works fine (i.e. endDate field is shown when value of toggle resolves to two). It is only when saving the the value disappears, even when removing the display property. So I consider this a bug. Maybe related to this one (which is a bit different, but also relating to content loss: Conditional field in structure looses content when condition is not default · Issue #7333 · getkirby/kirby · GitHub)

Hey Sonja, thanks so much for getting back to me so quickly! I totally agree, it seems like there’s a bug here and it matches https://github.com/getkirby/kirby/issues/7333. I’m so sorry I didn’t notice this topic earlier.