$record not available?

I am doing a standalone form with a repeater and everything is working great except that I cant seem to access $record in a repeater. If i try, its just null. $state always has the right value, but I cant seem to access the values from the current array of the repeater. There are values i want to use that wont have their own dedicated field. this is a standalone form where I am using $this->data(...); to dynamically add values to repeaters in a wizard.
Placeholder::make('name')
->content(function ($state, $record) {
ray($record)->label('record');
return new HtmlString('<span class="font-semibold">'.$state.'</span>');
})
->hiddenLabel(),
Placeholder::make('name')
->content(function ($state, $record) {
ray($record)->label('record');
return new HtmlString('<span class="font-semibold">'.$state.'</span>');
})
->hiddenLabel(),
4 Replies
Dennis Koch
Dennis Koch14mo ago
What's your form code? Did you pass $record?
Mark Chaney
Mark ChaneyOP14mo ago
I did not. I guess I should clarify, how do I get the values for a current repeater iteration. A repeater is an array of arrays, right? So each field is an array key, so makes sense that $state is its value, but how can I simply get the entirety of that iteration? I might actually be able to get that from $form->getState(). I’m just on my mobile and checking on a few things, will give it a try later
Dennis Koch
Dennis Koch14mo ago
You can also use the $get() method that’s injected into the closure.
Mark Chaney
Mark ChaneyOP14mo ago
well thats another problem, i am getting https://discord.com/channels/883083792112300104/1169879124811194428 at times too.
Want results from more Discord servers?
Add your server