F
Filament13mo ago
vkDas

Default data not showing in page

I have a custom resource page in which I have sent an email through this resource and a page will open when I click on the button present inside the mail and I want to show the corresponding data and the data is present inside the mount function but the data is not showing in the UI . All the data is present inside the $appraisal_response. Please help me to fix this issue...Thank you and here is the code class ResponseRequest extends EditRecord { protected static string $resource = ResponseResource::class; protected static string $layout = 'components.response-request.layouts.app'; public $employee_code_with_full_name; public $review_period_start_date; public $review_period_end_date; public $type; public $appraisal_session_id; public function mount(int | string $record = null): void { try { $data = JWT::decode(app('request')->input('token'), ['header' => true]); } catch (\Throwable $th) { abort(403); } $appraisal_response = Response::where([['id', $data['response_id']], ['status', ResponseStatus::DRAFT]])->first(); // dd($appraisal_response); if (!$appraisal_response) { abort(404); } parent::mount($appraisal_response->id); } protected function getHeaderActions(): array { return [ // ]; } protected function afterSave(): void { $this->record->status = ResponseStatus::SUBMITTED(); $this->record->save(); } public function form(Form $form): Form { $form = static::$resource::form($form, true); return $form; } }
2 Replies
Vp
Vp13mo ago
You need to fill the form like $this->form->fill($data) in mount
vkDas
vkDasOP13mo ago
Thank you for the response but in v2 this code is working fine but in v3 it is not working while I am triggering a email and I want to fill the form by default with the initial record values but it is not working. I tried this but when I try to set the default data using fill() it is not working and it is showing this error "Unable to find component: [app.filament.resources.appraisal-response-resource.pages.appraisal-response-request] and I can't configure out where the problem is occurring. Please help me to solve this issue. Thank you.
Want results from more Discord servers?
Add your server