Closed emteknetnz closed 4 months ago
I think the validator is working correctly - the developer should use the correct field name when setting their validator, i.e. it should be
RequiredFields::create(['MySiteTreeID'])
and not
RequiredFields::create(['MySiteTree'])
Does the bug you're fixing affect CMS 5.2?
If so, please retarget to the 5.2
branch since it's fixing a bug
Yeah looks like we don't need this one, I think there may have been some initial confusion with the "ID" suffix making me think things were broken when they were not
Turns out we do need this one, it's required for doing a page save of an inline-block where the has_one SiteTree::class in in RequiredFields. It's NOT required for saving non-inline block's.
It showed up as a behat failure in page-save-validation.feature on https://github.com/silverstripe/silverstripe-elemental/actions/runs/8961905824/job/24613378755?pr=1178#step:12:1052
Issue https://github.com/silverstripe/silverstripe-elemental/issues/1155
This fixes bugs with autoscaffolded SearchableDropdownField for has_one SiteTree relations
Replication steps
You can leave the field blank and submit and the required fields validation won't trigger