F
Filament11mo ago
jw

Textinput not populating relationship data in EditRecord Form

Hi all, As per the attached image, my TextColumn on the list page is showing related data correctly. However when using a TextInput on the EditRecord to show data from the related record it is not showing. public static function table(Table $table): Table { .... Tables\Columns\TextColumn::make('user.name') // Returns the correct data .... } public static function form(Form $form): Form { .... Forms\Components\TextInput::make('user.name'), // Returns no data .... } I wonder if there's some 'relationship' field or something I need to set on the TextInput? FYI, I have tried using a 'FieldSet' with the relationship set to User and putting the TextInput in there. That works, however when saving the form I don't get the data submitted. Perhaps there is a property I can set on the Fieldset that will allow the data to be posted? Thank you! PS: ( I have created a workaround by modifying the 'getEloquentQuery()' function on the ClubMemberResource page. I have joined the users table and selected the user.name column as 'users.user_name'. This allows me to create Forms\Components\TextInput::make('user_name') and it populates. However this feels like a hack and I'd like to know where I'm going wrong if possible.)
No description
Solution:
```php Forms\Components\Group::make([ Forms\Components\TextInput::make('name') ]) ->relationship('user')...
Jump to solution
7 Replies
Solution
LeandroFerreira
LeandroFerreira10mo ago
Forms\Components\Group::make([
Forms\Components\TextInput::make('name')
])
->relationship('user')
Forms\Components\Group::make([
Forms\Components\TextInput::make('name')
])
->relationship('user')
jw
jwOP10mo ago
Thanks @Leandro Ferreira! That works perfectly. Could you please tell me where the documentation is for this 'Group' component? I couldn't find it on the filament website. Thank you
jw
jwOP10mo ago
Thanks @toeknee, but that's not the one
toeknee
toeknee10mo ago
Ahh sorry, looks like it's been missed of the v3 docs. my IDE just auto completes when I do Group.
jw
jwOP10mo ago
Who do we speak to, to get it added to the official documentation? Or find out where it's located if I missed it.
Saade
Saade10mo ago
Open an issue on GH
Want results from more Discord servers?
Add your server