Update: I opened a GitHub issue for this, as distantnative suggested on Discord.
So here I was port some Kirby 2 code to Kirby 3 code, when I tried and save a page in the panel and it failed with a cryptic error.
Steps to Reproduce
- Grab the starterkit
- Edit the
about.yml
blueprint and add the lines from below - Open the
About us
page in the panel - Toggle the new toggle field on and off again
- Click save the page
- The form validation fails, as the only valid state of a toggle in Kirby 3, is the active state.
certain:
label: Are you sure?
type: toggle
default: false
required: true
text:
- "No"
- "Yes"
Actual Behavior
The validation error message returned form the endpoint doesn’t really make sense.
Expected Behavior
The validation error message explains that the toggle needs to be active.
HTTP 400 (Bad Request) response from the API endpoint
{
"status": "error",
"message": "Invalid form with errors",
"code": 400,
"exception": "Kirby\\Exception\\InvalidArgumentException",
"key": "error.invalidArgument",
"file": "\/kirby\/src\/Cms\/ModelWithContent.php",
"line": 771,
"details": {
"certain": {
"label": "Are you sure?",
"message": {
"required": "Invalid argument \"-\" in method \"-\""
}
}
},
"route": "pages\/([a-zA-Z0-9\\.\\-_%= \\+\\@\\(\\)]+)"
}