Skip to content

Commit

Permalink
Update checkbox.phtml
Browse files Browse the repository at this point in the history
Currently the Checkbox component cannot be properly used to save empty (unchecked status) settings. A hidden element is missing here, which is assigned the unchecked value.
  • Loading branch information
magicsunday committed Oct 24, 2024
1 parent 95621db commit c0cc34d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions resources/views/components/checkbox.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ declare(strict_types=1);
* @var string $label
* @var string $name
* @var string|null $value
* @var string $unchecked
*/

?>

<div class="form-check">
<input type="hidden" value="<?= e($unchecked) ?>" name="<?= e($name) ?>">
<input type="checkbox" class="form-check-input"
name="<?= e($name) ?>"
id="<?= e($id ?? $name . '-' . ($value ?? '1')) ?>"
Expand Down

0 comments on commit c0cc34d

Please sign in to comment.