Trying to dynamically disable file input, when checkbox is checked
Hi guys,
I have this code that will make the favicon the same as the logo when the checkbox is checked. If this is checked I want to disable the file input for favicon.
Don't worry about the TenantFileUpload it is exactly the same as FileUpload just with changed saving.
^^ this is code for the schema
and this is the page below
3 Replies
If someone could try reproduce this that would be great.
It disables a text input but when I link it to a file input it fails to disable it.
Any help appreciated thanks
Bump!
Hey @Jpac14
It looks like the issue might be related to how the
TenantFileUpload
component processes the disabled()
logic dynamically. File inputs in Filament don’t always respond the same way as text inputs when state changes, which could be why your checkbox logic isn’t working as expected.
Give this a try, its just my two cents so it may or may not work.
I am thinking that by adding the extraAttributes
property, you can use Alpine.js (x-bind
) to directly control the disabled
attribute on the file input. This works should dynamically with your checkbox state and avoids limitations with Filament's built-in logic.
ofc, you will also need to make sure that Alpine.js is included in your project.Hi Ava, I tried this but it didn't work. Maybe FileUpload doesn't work very well with dynamically disabling.
Not sure if this will help, but here is the code for TenantFIleUpload it is almost identical to FileUpload
If you have any other ideas let me know. Thanks, Jpac14