Custom resource page component data error.

I create a custom page for a simple resource.Inside the .blade of the page I added the line
{{ $this->form }}
{{ $this->form }}
then inside the page component i implemented the getFormSchema() method which has a radio and few text Inputs where one of the text inputs' visibility depends on the value of the radio as below
Wizard::make([
Wizard\Step::make('Personal information')
->description('Provide additional information about you.')
->schema([
Fieldset::make()->schema([
Radio::make('type')->options(['agent' => 'Agent', 'manager' => 'Manager'])->required()->reactive(),
TextInput::make('commision')->visible(fn (Callable $get) => $get('type') == 'agent' ? true : false),

]),
]),
Wizard::make([
Wizard\Step::make('Personal information')
->description('Provide additional information about you.')
->schema([
Fieldset::make()->schema([
Radio::make('type')->options(['agent' => 'Agent', 'manager' => 'Manager'])->required()->reactive(),
TextInput::make('commision')->visible(fn (Callable $get) => $get('type') == 'agent' ? true : false),

]),
]),
.The error i'm getting when i try to go the next step of the wizard is
Unable to set component data. Public property [$type] not found on component: [app.manager.resources.biodata-resource.pages.bioform]
Unable to set component data. Public property [$type] not found on component: [app.manager.resources.biodata-resource.pages.bioform]
. I'm not sure how to go about this error.
27 Replies
Filament
Filament2y ago
We need more information to help you debug your problem. Please click on the top left 'SHARE' button of the error page you're seeing and share the link with us.
lodeki
lodekiOP2y ago
Flare
No property found for validation: [type] - The error occurred at http://localhost:8000/manager/biodata
toeknee
toeknee2y ago
This like likely caused becasause you have not got the field as a public property on the component. I would suggest you put the form into a custom state like $data and manage it on an array basis for the form. see https://filamentphp.com/docs/2.x/forms/getting-started#scoping-form-data-to-an-array-property
Filament
Getting started - Form Builder - Filament
The elegant TALL stack form builder for Laravel artisans.
lodeki
lodekiOP2y ago
This one really didn't work
toeknee
toeknee2y ago
Then provide a copy of your livewire component and view so we can review
lodeki
lodekiOP2y ago
use App\Manager\Resources\BiodataResource;
use Filament\Resources\Pages\Page;


class Bioform extends Page
{

protected static string $resource = BiodataResource::class;
protected static ?string $title = 'Update biodata';
protected static ?string $slug = 'update-biodata-slug';
protected static string $view = 'filament.resources.biodata-resource.pages.bioform';



protected function getFormSchema(): array
{
return [
Wizard::make([
Wizard\Step::make('Personal information')
->description('Provide additional information about you.')
->schema([
use App\Manager\Resources\BiodataResource;
use Filament\Resources\Pages\Page;


class Bioform extends Page
{

protected static string $resource = BiodataResource::class;
protected static ?string $title = 'Update biodata';
protected static ?string $slug = 'update-biodata-slug';
protected static string $view = 'filament.resources.biodata-resource.pages.bioform';



protected function getFormSchema(): array
{
return [
Wizard::make([
Wizard\Step::make('Personal information')
->description('Provide additional information about you.')
->schema([
A snip of the custom page.
<x-filament::page>
<x-filament::card>
{{ $this->form }}
</x-filament::card>
</x-filament::page>
<x-filament::page>
<x-filament::card>
{{ $this->form }}
</x-filament::card>
</x-filament::page>
then this is the coresponding blade file
LeandroFerreira
Where is the mount method and the properties?
lodeki
lodekiOP2y ago
Tried them out but still got the same issue so i reverted the code to show you the original one.
lodeki
lodekiOP2y ago
Flare
Unable to set component data. Public property [$type] not found on component: [app.manager.resources.biodata-resource.pages.bioform] - The error occurred at http://localhost:8000/manager/biodata
LeandroFerreira
add public $type;
lodeki
lodekiOP2y ago
Okay . which means i'll have to create a variable for each input?
LeandroFerreira
Filament
Getting started - Form Builder - Filament
The elegant TALL stack form builder for Laravel artisans.
toeknee
toeknee2y ago
This is what I've already explained @Leandro Ferreira
LeandroFerreira
hey @lodeki ...
lodeki
lodekiOP2y ago
Yes .Let me try it again then i'll give the feedback.Thank you.
toeknee
toeknee2y ago
If you are using mount now then it'll be spot on
lodeki
lodekiOP2y ago
Okay .I'll give the feedback. Hello managed the same .However got some issues with the wizard .It does not show the submit button on the last step.
lodeki
lodekiOP2y ago
<x-filament::page>
<x-filament::card>
{{ $this->form }}
</x-filament::card>
</x-filament::page>
<x-filament::page>
<x-filament::card>
{{ $this->form }}
</x-filament::card>
</x-filament::page>
and this is the .blade.
Dan Harrin
Dan Harrin2y ago
so you havent used ->submitAction() check the wizard docs
lodeki
lodekiOP2y ago
Checked it out and added the submit button . However on click of the button , nothing happens .I would want to submit the data from the form and save it .
Dan Harrin
Dan Harrin2y ago
what code did you use for the button
lodeki
lodekiOP2y ago
this
->submitAction(new HtmlString('<button type="submit">Submit</button>'))
->submitAction(new HtmlString('<button type="submit">Submit</button>'))
Dan Harrin
Dan Harrin2y ago
and show me your code in the view that renders the form
lodeki
lodekiOP2y ago
This ..
<x-filament::page>
<x-filament::card>
{{ $this->form }}
</x-filament::card>
</x-filament::page>
<x-filament::page>
<x-filament::card>
{{ $this->form }}
</x-filament::card>
</x-filament::page>
Dan Harrin
Dan Harrin2y ago
you dont have a <form> how does livewire know where to send the data to please read the docs
lodeki
lodekiOP2y ago
My bad . Finally got the concept.Thank you.
Want results from more Discord servers?
Add your server