filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
17.59k stars 2.75k forks source link

Required checkbox inside modal wizard #13816

Closed OpJePl44tsm4n closed 1 month ago

OpJePl44tsm4n commented 1 month ago

Package

filament/filament

Package Version

v3.2.85

Laravel Version

v11.9.2

Livewire Version

v3.5.0

PHP Version

8.2

Problem description

When adding a required checkbox to a modal wizard, the field won't get validated.

Expected behavior

the checkbox should return a validation error. (this works in a modal without a wizard)

Steps to reproduce

Reproduction repository (issue will be closed if this is not valid)

https://github.com/OpJePl44tsm4n/filament-wizard-bug

Relevant log output

No response

Donate 💰 to fund this issue

Fund with Polar

zepfietje commented 1 month ago

This is caused by client-side validation not being executed (to fix issues in wizards). Checkboxes should use accepted() instead of required() for back-end validation. I'm wondering if we should apply accepted validation when using required() with a checkbox, @danharrin?

zepfietje commented 1 month ago

For now you may work around the issue by using accepted(), @OpJePl44tsm4n.

zepfietje commented 1 month ago

Given what I said above, I don't think this classifies as a bug actually. I'm going to close this issue, but we may introduce improvements as I suggested in my first comment.

danharrin commented 1 month ago

required is checking the value is not null, whereas accepted checks if it is true, we shouldnt apply both by default