Replies: 6 comments 8 replies
-
|
Hi. I was doing just that in my project and got the same error. Did you find any solutions? |
Beta Was this translation helpful? Give feedback.
-
|
I'm getting same error when I attempt to navigate to the previous step. |
Beta Was this translation helpful? Give feedback.
-
|
I started trying again and resolved the error by defining the form like this, i dont know yet if the data is persisted though |
Beta Was this translation helpful? Give feedback.
-
|
Hi @jurnskie did you find a solution for the problem ? I am getting the same error :( |
Beta Was this translation helpful? Give feedback.
-
|
Muchas gracias, pero ninguna de las soluciones propuestas funciono para mí de echo la función "getStepName" parece no existir, quedo a la ansiosa espera. |
Beta Was this translation helpful? Give feedback.
-
|
That's true @davitrix. You can get a current step name using Here is a simple trait i have created based on @kodyxgen solution. trait HasObjectForm
{
public function mountWithObjectForm(string $formClass = null, string $formProperty = 'form')
{
if (!$formClass) {
return;
}
$this->$formProperty = new $formClass($this, $formProperty);
$states = $this->allStepsState;
$currentComponentName = app(ComponentRegistry::class)->getName(static::class);
if (isset($states[$currentComponentName])) {
$this->$formProperty->fill($states[$currentComponentName][$formProperty]);
}
}
}Then in your component file you can use it like class UserDetailsStep extends StepComponent
{
use HasObjectForm;
public $form;
public function mount()
{
$this->mountWithObjectForm(UserDetailsForm::class);
// $this->mountWithObjectForm(UserDetailsForm::class, 'form'); Or passing the form property name
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi !
I'm trying to use FormObjects with Livewire Wizard. At first ik looks like its working great. But when navigating back to a previous step its trying to assign the FormObject as array onto the typed Form class of Livewire.
Steps to reproduce:
You will be presented with the following error:
Cannot assign array to property App\Livewire\AppointmentStepComponent\Steps\UserDetailsStep::$form of type App\Livewire\Forms\UserDetailsFormAnyone else run into this?
Beta Was this translation helpful? Give feedback.
All reactions