create a button or action that copy a value from another field
Hello, i want to ask how to make a button/action that copy a value to field itself that inside repeater.
i make like this but not working
Thank you for your help!
Solution:Jump to solution
Since you are in a repeater you have to traverse out of it for fields that aren’t in it. $set(‘../instituteName’)
25 Replies
Get $get on a suffix action?
Can you shware a bit more code ?
// https://filamentphp.com/docs/3.x/forms/actions#defining-a-form-component-action
Not tested 👀
First you
get
then you set
? Make sure you target the correct repeater.Hehe I needed something like this for something in my project. Was expecting that this action would copy to the clipboard but it doesn't
Take a look at this code its a bit older bit might be what you are looking for;
https://github.com/webbingbrasil/filament-copyactions/blob/3.x/src/Concerns/HasCopyable.php
GitHub
filament-copyactions/src/Concerns/HasCopyable.php at 3.x · webbingb...
A easy-to-use copy actions for Filament Admin Pages, Tables and Form Fields. - webbingbrasil/filament-copyactions
👀
Trying to work out how it should work. I am using it on a select
Something like this
I tried using your plugin but it looks like it is broken
What
GitHub
Method Webbingbrasil\FilamentCopyActions\Forms\Actions\CopyAction::...
Hi. I'm getting a Method Webbingbrasil\FilamentCopyActions\Forms\Actions\CopyAction::getDefaultCopyable does not exist exception when I try and use ->copyable in a TextInput suffix action: -...
Thats not mine
Just a suggestion
Ah I thought it was yours sorry
When I try this I am getting the error
Class "Forms\Components\Actions\Action" not found
😅
Got it working:
The tooltip is not yet working though
It seems to work. Just the tooltip appears somewhere random
Remkve the tooltip and add a custom notification
Hello, thank you for all your respond @CodeWithDennis @JJSanders, you people are so awesome
I mean i want to make an action that copy to itself like this code below
but i think this code is wrong
What do you mean by 'copy to itself'?
@JJSanders i mean the action button (instituteNameParticipant) do a copy from (instituteName) value and change the value of (instituteNameParticipant) value
I think your issue is in this line: $set('instituteNameParticipant', $get('instituteName'));
@JJSanders yes i mean, i want the action instituteNameParticipant get the value from instituteName field and copy the value to instituteNameParticipant field
Hmm,it doesn't seem like it can do that way right?
Just dump the values to check what you get.
First dump the get.
Solution
Since you are in a repeater you have to traverse out of it for fields that aren’t in it. $set(‘../instituteName’)
THANK YOU SO MUCH this is work hahah. I need traverse 2 times since inside wizard too.
@JJSanders @CodeWithDennis thank you for your concern and respond for this question! i really appriciate for both of your work!
@awcodes @JJSanders @CodeWithDennis Have a nice day!