© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•13mo ago•
3 replies
Jon Mason

form with multiple fields using the same model property

I have a single amount field on my model, and another field that indicates whether the amount is a credit or a debit. I need to display this data in a form and I'm having trouble creating 2 form fields based on the same model attribute.

I'm using this to get my form data (for the sake of this question, i'm leaving out the logic that differentiates between debits and credits):

    ->fillForm(function (AutomatedSalesJournalEntryHeader $record) {
                        return dd($record->lines->map(function (AutomatedSalesJournalEntryLine $line) {
                            return [
                                'account_ref_id' => $line->account_ref_id,
                                'debits' => $line->amount,
                                'credits' => $line->amount,
                                'description' => $line->description,
                            ];
                        })->toArray());
                    })
    ->fillForm(function (AutomatedSalesJournalEntryHeader $record) {
                        return dd($record->lines->map(function (AutomatedSalesJournalEntryLine $line) {
                            return [
                                'account_ref_id' => $line->account_ref_id,
                                'debits' => $line->amount,
                                'credits' => $line->amount,
                                'description' => $line->description,
                            ];
                        })->toArray());
                    })


And then I want to display them in these form fields:
    TextInput::make('debits')

        TextInput::make('credits')
    TextInput::make('debits')

        TextInput::make('credits')


I can dd the fillForm method and I get the expected data, but it's not populating in the form fields. The only way I can get any data to populate in the form fields is to name the field the same as my model, and then it just seems to disregard the
fillForm
fillForm
method.
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Using same model for multiple resources
FilamentFFilament / ❓┊help
16mo ago
Multiple resources using same model not working
FilamentFFilament / ❓┊help
12mo ago
Same width text fields in the form
FilamentFFilament / ❓┊help
3y ago