From ccbbd918221ee20c446bbd236e9d0cd0e514ac89 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 14 Oct 2016 07:47:57 +1300 Subject: [PATCH] Set values on readonly/disabled fields These field variations are not corresponding to properties on the underlying DataObject, hence need to be set manually. At the moment, Form->loadDataFrom() is never called during schema generation, so the setValue() calls are required for all fields - which is a bug in the LeftAndMain->schema() implementation. --- code/BasicFieldsTestPage.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/code/BasicFieldsTestPage.php b/code/BasicFieldsTestPage.php index 9ad93c1..26b10d3 100644 --- a/code/BasicFieldsTestPage.php +++ b/code/BasicFieldsTestPage.php @@ -263,11 +263,13 @@ class BasicFieldsTestPage extends TestPage $disabledField = $field->performDisabledTransformation(); $disabledField->setTitle($disabledField->Title() . ' (disabled)'); $disabledField->setName($disabledField->getName() . '_disabled'); + $disabledField->setValue($field->Value()); $tabObj->insertAfter($disabledField, $field->getName()); $readonlyField = $field->performReadonlyTransformation(); $readonlyField->setTitle($readonlyField->Title() . ' (readonly)'); $readonlyField->setName($readonlyField->getName() . '_readonly'); + $readonlyField->setValue($field->Value()); $tabObj->insertAfter($readonlyField, $field->getName()); } }