F
Filament8mo ago
Horia

Render custom calculated field in a form

I have a form which takes some inputs and based on that inputs (number of persons) I need to calculate some price. Can I do that in a custom view field? How do I inject the current form state in that view? Or some parameters to display?
2 Replies
Dennis Koch
Dennis Koch8mo ago
Yes you can use a View field. I think you can use $evaluate(fn ($get) => $get('your_field')) to retrieve other values.
Horia
Horia8mo ago
Thanks @Dennis Koch , that works at an extent. My price calculation is quite complex, and would help if I could do that in my component, after some state is updated, and display in my view the public field holding the calculated price. But I am not sure if I can do that?