HI, I’m trying out to change from V4.8 to V5 and I do get an error when trying to access some subpages via the panel - it throws me the error “Cannot assign string to property Kirby\Form\Field::$when of type ?array”. Sorry for that probably stupid question (I’m not a programmer), but what does this mean and how can I fix this? Is this because I used the type: structure in the blueprint for my fields?
Could you post the blueprint of the page in question, please?
Sure, Thank you:
title: Arbeitsgruppen
tabs:
main:
columns:
main:
width: 3/4
sections:
content:
type: fields
fields:
main_content:
label: Main Content
extends: fields/maincontent
news:
label: News / Info
extends: fields/textinput
sidebar:
width: 1/4
sections:
workgroups:
type: pages
label: Workgroups
layout: cardlets
image: false
query: page.children
text: "{{ page.title }}"
info: "{{ page.description.short(500) }}"
pages: true
template: workgroup
seo: seo/page
and the fields snippets are:
label: Main Content
type: structure
columns:
subheadline:
label: Sub-Headline
width: 1/4
description:
label: Description
width: 1/2
files:
label: Files Upload
width: 1/6
fields:
subheadline:
label: Sub-Headline
type: text
required: true
description:
label: Description
extends: fields/textinput
required: true
people:
label: People
extends: fields/members
files:
label: Files Upload
extends: fields/files
width: 1/2
links:
label: External Links
extends: fields/links
width: 1/2
textinput:
label: News / Info
extends: fields/textinput
buttons:
label: Page Buttons
extends: fields/buttons
and
label: Textfeld
type: writer
autofocus: true
nodes: true
headings:
- 2
- 3
- 4
toolbar:
marks:
- bold
- italic
- underline
- strike
- sub
- sup
- '|'
- quote
- '|'
- link
- email
- '|'
- clear
inline: false
help: >
For a list select unordered or ordered list. Use **Enter** to add a new list item, **Tab** to indent, and **Shift+Tab** to outdent.
For keeping a new line to automatically gets wrapped in a paragraph, use **Shift+Enter** for a hard break.
Hm, there are a lot of fields that are hidden away in their own files. I was expecting to see some when conditions somewhere.
Not so sure if I understand you - you would suggest conditions or you thought the problem occurs because there were some conditions?
I can also post the other snippets of members, files, links, and buttons (though, everything worked fine in Kirby 4.8.0 and I haven’t changed anything with the code):
Buttons:
type: group
fields:
buttons:
label: Page Buttons
type: structure
width: 1/1
fields:
page:
label: Link to Page
type: pages
multiple: false
query: page.children
help: Select the subpages you want to link as buttons.
label:
label: Button Label
type: text
help: Optional custom label for the button. If left empty, the page title will be used.
links:
label: External Links
type: structure
fields:
label:
label: Link Text
type: text
url:
label: URL
type: url
files:
label: Files Upload
type: files
multiple: false
accept:
- image/jpeg
- image/png
- application/pdf
members:
type: group
fields:
people:
label: People and Contact
type: structure
fields:
function:
label: Function
extends: fields/textinput
name:
label: Name
extends: fields/textinput
pronouns:
label: Pronouns
extends: fields/textinput
affiliation:
label: Affiliation
extends: fields/textinput
contact:
label: Contact
extends: fields/textinput
The error message suggests that you are using somewhere a when option and that’s something wrong with that. This is why we are searching for that when condition in the blueprints you posted but I cannot see any. But since you are using a lot of extends it’s probably in one of those that we cannot see.
Ah, OK. So the only “when” that I do have used is within the “events”. I’m sorry, I guess I confused the parent’s page with the actual children’s blueprints. There actually IS a “when” with the events:
title: AG-Subpage
tabs:
main:
label: Main Content
type: fields
fields:
main_content:
label: Description
extends: fields/maincontent_events
width: 1/1
news:
label: News / Info
extends: fields/textinput
width: 1/1
seo: seo/page
this is the Main Content including Events Blueprint:
label: Main Content
type: structure
columns:
subheadline:
label: Sub-Headline
width: 1/4
description:
label: Description
width: 1/2
files:
label: Files Upload
width: 1/6
events:
label: Events
width: 1/6
fields:
subheadline:
label: Sub-Headline
type: text
description:
label: Description
extends: fields/textinput
people:
label: People extern
extends: fields/members
info:
label: News / Info
extends: fields/textinput
files:
label: Files Upload
extends: fields/files
width: 1/3
links:
label: External Links
extends: fields/links
width: 1/3
email:
label: Emailcontact
extends: fields/email
width: 1/3
buttons:
label: Page Buttons
extends: fields/buttons
events:
label: Events
extends: fields/event
width: 1/3
and here the events including conditions:
type: group
fields:
eventSessions:
label: Event Sessions
type: structure
max: 20
columns:
eventTitle:
label: Title
width: 1/2
start_date:
label: Start Date
type: date
format: DD.MM.YYYY
width: 1/4
start_time:
label: Time
type: time
width: 1/4
fields:
eventTitle:
label: Headline Session Title
type: text
required: true
help: This field is required.
width: 1/1
eventDescription:
label: Event Description
extends: fields/textinput
width: 1/1
start_date:
label: Start Date
type: date
required: true
help: This field is required.
format: YYYY-MM-DD
width: 1/4
when:
event_type: one-off
end_date:
label: End Date
type: date
format: YYYY-MM-DD
required: true
help: This field is required.
width: 1/4
when:
event_type: one-off
start_time:
label: Start Time
type: time
required: true
help: This field is required.
interval: 15 # minute interval for time picker
width: 1/4
end_time:
label: End Time
type: time
required: true
help: This field is required.
interval: 15
width: 1/4
archive_mode:
label: Archive Mode
type: radio
required: true
help: This field is required.
options:
auto: Automatic
manual: Manual
default: auto
width: 1/3
help: Choose how the event will be archived - in automatic mode, it archives one day after the event ends. In manual mode, the archiving date archives not before at least two custom days after the event ends.
should_archive:
label: Ready for Archive
type: toggle
text:
- "Do not archive yet"
- "Archive now when due"
default: false
width: 1/3
when:
archive_mode: manual
help: If set to "Archive now when due", this event will automatically move to the archive page.
archive_date:
label: Archive Date
type: date
width: 1/3
help: In automatic mode, archive date will be one day after event ends. In manual mode, it will be two days after event ends. Adjust if needed.
#gap:
#type: gap
#width: 1/3
event_type:
label: Event Type
type: radio
required: true
help: This field is required.
options:
one-off: One-off
recurring: Recurring
default: one-off
width: 1/3
recurring_days:
label: Recurs On Weekdays
type: checkboxes
options:
- monday
- tuesday
- wednesday
- thursday
- friday
- saturday
- sunday
when:
event_type: recurring
width: 1/3
recurring_pattern:
label: Recurrence Pattern
type: radio
options:
weekly: Every Week
biweekly: Every 2 Weeks
triweekly: Every 3 Weeks
monthly: Once a Month
bimonthly: Twice a Month
ordinal_month: Every 1st/2nd/Last Weekday of the Month
when:
event_type: recurring
width: 1/3
recurring_note:
label: Recurrence Details
extends: fields/textinput
help: Add a free-form description if needed (e.g., “Every 2nd Tuesday until June”).
when:
event_type: recurring
width: 1/1
location:
label: Location
required: true
help: This field is required.
extends: fields/textinput
width: 1/1
additional_info:
label: Additional Info
extends: fields/textinput
width: 1/1
pdf:
label: PDF Attachment
type: files
max: 3
multiple: false
accept:
- application/pdf
width: 1/2
image:
label: Event Image
type: files
max: 3
multiple: false
accept:
- image/jpeg
- image/png
width: 1/2
Don’t know if it comes from pasting here, but there is an indentation missing here?
OMG… I AM SOOO SORRY for taking your time for this SUPERSTUPID mistake
YEAH, sure, there were the indents missing… AND now it works… THANKS A LOT and SORRY again! (though, still don’t know why kirby 4.8.0 did not throw me an error, but good that kirby 5 is more sensitive
)