F
Filament13mo 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 Zeus13mo ago
hope this will work Textinput::make('lat')->default(fn()=>$this->latitude),
arul
arulOP13mo ago
not work, thanks.
awcodes
awcodes13mo 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.
Want results from more Discord servers?
Add your server