Prohibits on Checkbox not working
I have form with a checkbox and a date picker. Neither are required but both should never be fillable/submittable together. I am using the
prohibits
rule so one blocks the other.
Leaving the fields blank works, only ticking start_immeditately
works, however selecting a start_date
but leaving start_immediately
blank throws a validation error as shown in the image as the start_immeditately
field is present even if it’s value is false
. Is there are way around this?
Solution:Jump to solution
I can use a custom rule like so which fixes this. I think it’s the only way to make it work as the built-in rules don’t always play well with checkboxes
```php
Forms\Components\Checkbox::make('start_immediately')
->rules([...
1 Reply
Solution
I can use a custom rule like so which fixes this. I think it’s the only way to make it work as the built-in rules don’t always play well with checkboxes