F
Filament15mo ago
arul

how to show default value TextInput from public property

Public latitude; Textinput::make(lat)-default($this->latitude); How to show latitude value in filament form input ?
3 Replies
Lara Zeus
Lara Zeus15mo ago
hope this will work Textinput::make('lat')->default(fn()=>$this->latitude),
arul
arulOP15mo ago
not work, thanks.
awcodes
awcodes15mo ago
->default(fn($record) => $record->latitude) Note that default only works on create I misread your question sorry. Pretty sure $this isn’t going to be available in a callback like that. It should be provided to the form in mount. $this->form->fill([‘lat’ => $this->latitude]) You will also need to handle the other form field in the fill method too though. It does feel like you are possibly mixing some conventions here though.

Did you find this page helpful?