F
Filament12mo ago
Emaz

Dot notation in form edit

I know this should be easy. I use dot notation in my table. Property model has a serivce_id and service model has a price. So in my property resource I use service.price no problem. In my form I want this to be a computed property. The default will be the same service.price but that just leaves the field blank. I thought I'd compute with pricing add ons after that but I can't get that initial field to fill. I thought I could do: Forms\Components\TextInput::make('service.price') ->disabled() ->dehydrated(false), But it just remains blank.
Solution:
Dot notation doesn’t work for form names. You would need to wrap the input in a layout container that supports relationships. Then the layouts schema can be scoped to the relationship. So Layout::make(‘service’)->relationship() and TextInput::make(‘price’)...
Jump to solution
2 Replies
Solution
awcodes
awcodes12mo ago
Dot notation doesn’t work for form names. You would need to wrap the input in a layout container that supports relationships. Then the layouts schema can be scoped to the relationship. So Layout::make(‘service’)->relationship() and TextInput::make(‘price’)
Emaz
EmazOP12mo ago
Disappointing. But at least I'm not crazy LOL Kind of surprised this is the first time I've run into this. Thanks!

Did you find this page helpful?