F
Filament8mo ago
Junaid

Unable to add Actions Inside Placeholder content of edit modal form.

How can I add an action inside Placehoder inside form widget. Here is how I have used Placeholder: Placeholder::make('notes') ->label('') ->content( function ($record) { if ($record?->notes) { foreach ($record?->notes as $note) { echo "<div class='bg-gray-100 p-2 mb-2 rounded-lg'>"; // echo "<div class='text-sm text-gray-500'>{$note->user->name} - {$note->created_at->diffForHumans()}</div>"; echo "<div class='text-sm'>{$note->content}</div>"; echo "</div>"; } } } ), I am displaying the notes of a user and I want to add a delete/remove action next to each note
Solution:
Why don't you use a Repeater instead? If you really want custom formatting, you are better off with a custom view file or view field...
Jump to solution
5 Replies
Solution
Dennis Koch
Dennis Koch8mo ago
Why don't you use a Repeater instead? If you really want custom formatting, you are better off with a custom view file or view field
Junaid
JunaidOP8mo ago
@Dennis Koch I don't really like the UI of Repeater. Here is my current UI and here adding a delete button would look more clean then Repeater. By using repeater It makes my edit modal scrollable and UI starts getting annoying.
No description
awcodes
awcodes8mo ago
Since it’s only one field the simple repeater might work. But there’s also #awcodes-table-repeater maybe that will work.
Dennis Koch
Dennis Koch8mo ago
If you don't like the repeater you should create a custom field or use a view field. But putting this all inside Placeholder is hacky as hell
Junaid
JunaidOP8mo ago
@Dennis Koch Thanks Repeater works for me for now so I will go with it
Want results from more Discord servers?
Add your server