diff --git a/src/Support/Html/Mixins/HtmlExtendedMixin.php b/src/Support/Html/Mixins/HtmlExtendedMixin.php
index d24a3f4..0e0f2e5 100644
--- a/src/Support/Html/Mixins/HtmlExtendedMixin.php
+++ b/src/Support/Html/Mixins/HtmlExtendedMixin.php
@@ -8,15 +8,12 @@
use Spatie\Html\Elements\Form;
use stdClass;
-#[\AllowDynamicProperties]
class HtmlExtendedMixin extends stdClass
{
- protected ?Livewire $form = null;
-
public function wireForm(): mixed
{
return function (Livewire $form, ?string $action = null): Form {
- $this->form = $form;
+ $this->request->attributes->set('form', $form);
return Form::create()
->attributeIf($action, 'wire:submit', $action);
@@ -26,7 +23,7 @@ public function wireForm(): mixed
public function closeWireForm(): mixed
{
return function (): Form {
- $this->form = null;
+ $this->request->attributes->remove('form');
return Form::create()->close();
};
@@ -35,7 +32,7 @@ public function closeWireForm(): mixed
public function error(): mixed
{
return function (string $field, ?string $message = null, ?string $format = null): Validate {
- $messageBag = $this->form?->getComponent()->getErrorBag();
+ $messageBag = $this->request->get('form')?->getComponent()->getErrorBag();
$hasMessage = $messageBag?->has($field) ?? false;