Create Slug Automatically on Text Input Not Working Properly
Here I create a slug automatically based on name input. I use the same code as the docs https://filamentphp.com/docs/3.x/forms/advanced#generating-a-slug-from-a-title
From the video I attached, you can see that whenever slug is updated it got the name field somehow got reset. I'm not sure if there's a settings I should do because in version 2 using reactive, it was working properly.
I'm trying to write Spongebob on the video.
Thank you for all the help.
12 Replies
You need to debounce or onBlur in the live() modifier.
Just ran into the same issue.
Thanks for the fix!
Shouldn't there also be a debounce in the live() in the code in the docs at that section as well then? Because as is, it is not usable.
And I'm not even sure this is a great solution. Even with a debounce it is possible to loose letters.
looks like slow requests, but for slugs, i prefer to
->live(onBlur: true)
and not mess with debouncing
the slug field will only be updated after the blur event of the name fieldThat's what I use right now and that's fine for this usecase. Maybe that should be part of the code in the docs then.
It seems that the prefix is not appended to the input field's value. Am I missing something?
I need to manually add the
https://
protocolFor a url field you will always need to add a valid http:// or https:// url.... If you don't just write you own rule to validate a url without http/https
prefix is just a UI thing, it does not affect the state of the component. you need to
dehydrateStateUsing
and prefix manually the state if you wantIs it possible to set the text size for a TextColumn's description?
I tried that but it only changes the text size of the main text, not the description.
Oh! My apologies. I misread that. 🤦♂️
I think you can do that by returning a
new HtmlString('<large>' . $record->customer->address . '</large>')
(or maybe <p class="text-sm">
, etc)Or, you could skip the description and add the column as a Stacked entry. An example is in the Filament Demo app:
https://github.com/filamentphp/demo/blob/964d38a387a2e31bde366cccbf09fafb7e38d68a/app/Filament/Resources/Blog/AuthorResource.php#L56-L74
GitHub
demo/app/Filament/Resources/Blog/AuthorResource.php at 964d38a387a2...
Source code for the demo.filamentphp.com website. Contribute to filamentphp/demo development by creating an account on GitHub.