F
Filament4mo ago
Oi

how do I give a default value to a field using a closure that has access to the record

I want to have a checkbox that is either checked or unchecked based on some arbitrary code in a closure that gets access to the $record. Is this possible? Currently I am getting the error Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
Solution:
Because this is the form builder, you can use $form->getModelInstance() along with the default method on components
Jump to solution
3 Replies
Sdeev
Sdeev4mo ago
i try this to calculate the total but not wokring for me
Solution
Oi
Oi4mo ago
Because this is the form builder, you can use $form->getModelInstance() along with the default method on components