Lazy Mode with Conditional Visibility & Custom AutoSave Behavior
I'm building a Filament form and I want to implement two behaviors for my fields:
1. Conditional Visibility
I want the TextInput field (answer) to only be visible if the Select field (question) has a value of
1 (Yes)
. If 0 (No)
, it should hide the TextInput.
2. Per-Field AutoSave (on Submit Only)
Each field has an autoSave()
function that should be triggered only on form submission (or a button click).
However, when changing the Select field (to toggle visibility), I want to prevent triggering autoSave on the hidden/shown field. Basically:
✅ autoSave should run on submit
❌ autoSave should not run when Select changes
Here's my current setup:
My Questions:
How can I conditionally show/hide the TextInput based on the Select value?
How do I suppress autoSave on afterStateUpdated() when visibility is toggled?
Is there a clean way to handle this without triggering unnecessary saves?
Any best practices or suggested patterns are welcome!0 Replies