Skip to content

Commit 5da3ce3

Browse files
authored
Merge pull request #15711 from marcusmoore/fixes/custom-fieldset-checkboxes
Fixed custom field checkboxes on asset edit page
2 parents c3bbca3 + 5ecd2b6 commit 5da3ce3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

app/Livewire/CustomFieldSetDefaultValuesForModel.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ private function populatedSelectedValuesArray(): void
8181
{
8282
$this->fields->each(function ($field) {
8383
$this->selectedValues[$field->db_column] = $this->getSelectedValueForField($field);
84+
85+
// if the element is a checkbox and the value was just sent to null, make it
86+
// an array since Livewire can't bind to non-array values for checkboxes.
87+
if ($field->element === 'checkbox' && is_null($this->selectedValues[$field->db_column])) {
88+
$this->selectedValues[$field->db_column] = [];
89+
}
8490
});
8591
}
8692

0 commit comments

Comments
 (0)