Set number fields to null if no value entered
This commit is contained in:
parent
8dcef0ebfb
commit
60958efeed
|
|
@ -706,7 +706,9 @@ class Form extends WidgetBase
|
||||||
$columnParts = Str::evalHtmlArray($field->columnName);
|
$columnParts = Str::evalHtmlArray($field->columnName);
|
||||||
$columnDotted = implode('.', $columnParts);
|
$columnDotted = implode('.', $columnParts);
|
||||||
$columnValue = array_get($data, $columnDotted, 0);
|
$columnValue = array_get($data, $columnDotted, 0);
|
||||||
if ($field->type == 'number') $columnValue = (float) $columnValue;
|
if ($field->type == 'number') {
|
||||||
|
$columnValue = !strlen(trim($columnValue)) ? NULL : (float) $columnValue;
|
||||||
|
}
|
||||||
array_set($data, $columnDotted, $columnValue);
|
array_set($data, $columnDotted, $columnValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue