Copy contents of first repeater fields to another

I am creating form having address fields of users. Each repeater item contains address fields of one user. Now I want to create a button which will copy the data of address fields from first repeater item and paste it into relevant fields of other repeater. As per my understandings, we need copy the state of fields that I wanted, but can't figure out how do I copy and paste it to other fields.
9 Replies
krekas
krekas15mo ago
Use $get with $set
Akshay Bokade
Akshay BokadeOP15mo ago
@krekas Can you please show me how. Let say this is my code inside repeater Forms\Components\Textarea::make('home_address.address1') ->label('Address 1') ->required(), Forms\Components\Textarea::make('home_address.address2') ->label('Address 2'),
Akshay Bokade
Akshay BokadeOP15mo ago
@awcodes Not exactly. Because I don't want to copy the data of all fields, only few fields data are required to get copied.
krekas
krekas15mo ago
So create action which will get the values and set them in the next repeater
paanblogger
paanblogger15mo ago
$get('..\fieldname')
Akshay Bokade
Akshay BokadeOP15mo ago
@krekas Can you please show me how to do this?
krekas
krekas15mo ago
How can I show what I don't have? First try yourself
Akshay Bokade
Akshay BokadeOP15mo ago
Yo, So Mr. Luffy, Can you show me how to do this, a code snippet will be more helpful. Ok let me try
Want results from more Discord servers?
Add your server