-
Notifications
You must be signed in to change notification settings - Fork 328
Open
Labels
Description
Module version(s) affected
5.2
Description
setReadonly(true) does not work on a checkboxField (and potentially others).
How to reproduce
Take a DataObject with a bunch of fields and then run:
foreach (array_keys($this->config()->get('db')) as $readonlyField) {
$formFieldTmp = $fields->dataFieldByName($readonlyField);
if ($formFieldTmp) {
$formFieldTmp->setDescription('set to readonly');
$fields->replaceField($readonlyField, $formFieldTmp->setReadonly(true));
}
}and for each field asses it it acts and looks and feels as readonly
Possible Solution
implement properly across of fields OR, use performReadonlyTransformation instead.
Additional Context
What would be nice if you could simply write:
$fields->dataFieldByName('MyBooleanField')->setReadonly(true)and it would actually change, rather than having to replace the original field.
Validations
- Check that there isn't already an issue that reports the same bug
- Double check that your reproduction steps work in a fresh installation of
silverstripe/installer(with any code examples you've provided)