/** * We have to tap in here to correct "50" to "0.5" for the percent * field. This is a common user error and it's nice to just fix it * for them. * * @param string $fieldName Name of the field * @param mixed $value New field value * @return DataObject $this */ public function setCastedField($fieldName, $value) { if ($fieldName == 'Percent' && $value > 1) { $value /= 100.0; } return parent::setCastedField($fieldName, $value); }