I wish to include a calculated input field in a form, which is sum of a number of fields, some of which are dynamically included based on an attribute of the record. Although, I would calculate the value in the backend, I want to have the calculated value shown in the form itself while creation.
I've tried
evaluate()
evaluate()
method as well as
state()
state()
method both of which give
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
Is there a way to include such calculated fields? Alternatively, how I can I include custom javascript only for the form of a particular resource? As then I can calculate the field value via javascript.
Solution
have you tried a Placeholder with content(function () {}) ?