error on createOptionsForm in multiple forms in livewire page
Missing [$rules/rules()] property/method on: [App\Livewire\Buy\InpBuy].
this error message when press add button in CreateOptionForm in livewire page with multiple forms.
Although the same CreateOptionForm with the same code work well in other resource page.
7 Replies
any help Plz
Show your code and maybe someone will be able to help you. We have no idea what you could be talking about.
This the code of Select (in livewire page)
Select::make('supplier_id')
->label('المورد')
->relationship('Supplier','name')
->live()
->required()
->inlineLabel()
->columnSpan(3)
->afterStateUpdated(function ($state){
$res=Buys_work::find($this->buy_id);
$res->supplier_id=$state;
$res->save();
})
->createOptionForm([
Section::make('ادخال مورد جديد')
->schema([
TextInput::make('name')
->required()
->label('الاسم'),
TextInput::make('address')
->label('العنوان'),
TextInput::make('mdar')
->label('مدار'),
TextInput::make('libyana')
->label('لبيانا'),
Hidden::make('user_id'),
])
])
the same code is in other resource page work , but in this page the modal of create is open and after I fill data and press add button show error (Missing [$rules/rules()] property/method on: [App\Livewire\Buy\InpBuy].)
other note : in this page there are two forms
What exactly are you trying to do here?
It doesn't seem conventional to do an Eloquent operation such as
$res->save()
within a afterStateUpdated()
method.
That is why I am askingit work well (I mean afterStateUpdated) , even when I removed the afterStateUpdated the same error rise. the error rise when CreateOptionForm . other than that every things are work well.
Well it’s probably something else in your component then. Is your relationship method name supposed to be uppercased for the first letter? Maybe change it to “supplier” instead.
yes it is uppercase.