F
Filamentβ€’16mo ago
bahamagician

requiredIf() validation isn't working for File Upload component

I'm having a problem where the requiredIf validation doesn't work when I use it on a File Upload component. See code below. Is there a way around this?
Forms\Components\FileUpload::make('delivery_scan')
->requiredIf('delivery_type', 'Boat')
->columnSpan([
'md' => 2,
]),
Forms\Components\FileUpload::make('delivery_scan')
->requiredIf('delivery_type', 'Boat')
->columnSpan([
'md' => 2,
]),
3 Replies
bahamagician
bahamagicianOPβ€’16mo ago
Ended up having to use $get() to customize it as below:
Forms\Components\FileUpload::make('delivery_scan')
->required(fn (Get $get) => $get('delivered') === true )
->columnSpan([
'md' => 2,
]),
Forms\Components\FileUpload::make('delivery_scan')
->required(fn (Get $get) => $get('delivered') === true )
->columnSpan([
'md' => 2,
]),
i really can't play that
Thx mate, This got on my nerves πŸ™‚
krekas
krekasβ€’15mo ago
It might be because of livewire 3 bug. There's a pr to fix it
Want results from more Discord servers?
Add your server