© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
Karim Bakhsh

files not previewed when form is pre-filled with data

I have a form which has the following schema

protected function getEditBillItemFormSchema(): array
    {
        return [
            Forms\Components\Card::make([
                // Input::medicalBillType('type', $this->bill_items->pluck('type')->toArray())->reactive()->disabled(),
                Forms\Components\TextInput::make('type')->disabled(),
                Input::decimalInput('fee')->required(),

                Forms\Components\DatePicker::make('date_of_care')
                    ->visible(fn (\Closure $get) => $get('type') === 'physication')
                    ->required(),

                Forms\Components\Textarea::make('description')->rows(2)->cols(20)
                    ->nullable()->maxLength(250)->columnSpanFull(),

                    FileUpload::make('attachments')->multiple()->directory(fn (\Closure $get) => $get('type'))->columnSpanFull(),

                // Input::fileUpload('attachments')->directory(fn (\Closure $get) => $get('type'))->columnSpanFull(),
            ])->columns(2),
        ];
    }
protected function getEditBillItemFormSchema(): array
    {
        return [
            Forms\Components\Card::make([
                // Input::medicalBillType('type', $this->bill_items->pluck('type')->toArray())->reactive()->disabled(),
                Forms\Components\TextInput::make('type')->disabled(),
                Input::decimalInput('fee')->required(),

                Forms\Components\DatePicker::make('date_of_care')
                    ->visible(fn (\Closure $get) => $get('type') === 'physication')
                    ->required(),

                Forms\Components\Textarea::make('description')->rows(2)->cols(20)
                    ->nullable()->maxLength(250)->columnSpanFull(),

                    FileUpload::make('attachments')->multiple()->directory(fn (\Closure $get) => $get('type'))->columnSpanFull(),

                // Input::fileUpload('attachments')->directory(fn (\Closure $get) => $get('type'))->columnSpanFull(),
            ])->columns(2),
        ];
    }


and there is a button that when I clicked some data is pre-filled on this form. Here is how that is done.

public function editBillItem($index)
    {
        $this->currentEditIndex = $index;
        $this->editData = $this->bill_items[$index];
        $this->editBillItemForm->fill([
            'type' => $this->editData['type'],
            'fee' => $this->editData['fee'],
            'date_of_care' => $this->editData['date_of_care'] ?? '',
            'description' => $this->editData['description'],
            'attachments' => $this->editData['attachments'],
        ]);
    }
public function editBillItem($index)
    {
        $this->currentEditIndex = $index;
        $this->editData = $this->bill_items[$index];
        $this->editBillItemForm->fill([
            'type' => $this->editData['type'],
            'fee' => $this->editData['fee'],
            'date_of_care' => $this->editData['date_of_care'] ?? '',
            'description' => $this->editData['description'],
            'attachments' => $this->editData['attachments'],
        ]);
    }

and here is the data shown before getting filled into the form (shown on the picture).
image.png
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Form does not display filled data.
FilamentFFilament / ❓┊help
2y ago
Action->form() not getting filled when reusing form
FilamentFFilament / ❓┊help
17mo ago
Before form is filled, any function?
FilamentFFilament / ❓┊help
11mo ago
auth()->user-> not filled in form
FilamentFFilament / ❓┊help
3y ago