Form with Textarea on custom widget causing JS errors
I have a custom widget added to a resource view page. The widget is implementing a form according to https://filamentphp.com/docs/3.x/forms/adding-a-form-to-a-livewire-component. My form is for adding comments, so its quite simple:
However, this is causing JS errors in my Browser console:
Is this a filament bug or an issue on my end? I am on the latest filament version š¤ The error disappears, if I change from Textarea to Textinput in my form.
Is this a filament bug or an issue on my end? I am on the latest filament version š¤ The error disappears, if I change from Textarea to Textinput in my form.
50 Replies
It appears that the issue is somehow caused by the fact that the Resource defines an infolist, which gets rendered on my ViewPage š¤
did you add
$this->form->fill()
in the mount method?Yes š
running in to the same issue in the adminpanel.
on the Textarea field.
Are you using panel builder or only the form builder? Could you share the code?
+1
Textarea?
Yep
Exactly the same error
please run:
php artisan about
It's here:
vendor/filament/forms/resources/views/components/textarea.blade.php
try:
->height('100px')
It's an Alpine variable
that is not initialized
I can see that, I wasn't sure if we were setting it higher up.
LEt me check
Already tried "->extraAlpineAttributes(['height' => '0px'])"
Working fine here.
run:
npm run build
doenst work
i'm running npm run dev
As stated above, i'm running the form inside a livewire component page
Yeah I was too... and it works fine... I suspect your frontend implementation may not be right
I thing the problem is in the loading sequence
As you can see the textarea.js is loading
But the error "textareaFormComponent is not defined" says that doesnt exists
Notice the value not defined here:
The component ist trying to load the Alpine component here: ax-load-src="{{ \Filament\Support\Facades\FilamentAsset::getAlpineComponentSrc('textarea', 'filament/forms') }}"
I'm using this Livewire component inside a Widget
š¤
Probably filament loads the widget before teh other assets
Besides the console error everything works fine š
filament version?
v3.2.92
update this please
if it won't work, share the whole code please
ok
thank you
v3.2.94
the same
could you share the whole code?
It's a private project, but i will try to share these pieces
you could create a mini repo on github to reproduce this issue
Hi Leandro
I've publish the repo here:
GitHub
GitHub - pedro-vasconcelos/filament-textarea
Contribute to pedro-vasconcelos/filament-textarea development by creating an account on GitHub.
/go to reach the admin panel, he will fill the login box automatically
The widget is on the dashboard
where is the livewire component?
app/Livewire/TestWidget.php
I went a little bit further and I think filament loads the html with the alpine before alpine-sync loads the textarea.js
or in reverse
check again
please
add
nope
does not work
i already tested that on the main project
add
WTF
It worked
Why?
Will disable the alpine-async?
Thanks a lot for your time š Obrigado mesmo š (You have a Portuguese name, I'm from Portugal)
the lazy loading was breaking the lifecycle
NP āļø
@Samus_Aran š
How would this work in the panel builder?
for future ref:
in my case i fixed it in the panelbuilder because i forgot to add
Thank you for tagging me! Fixed the issue on my end as well!