Reactive Builder field
Hello I want to create Builder field with lets say three blocks:
- Hero
- Footer
- Header
Is there a possibility to create for example reactive text input / placeholder that will fill whenever you Add a section in Builder field? I've tried to add reactive() and afterStateUpdate() in few places but I cant really get any effect
3 Replies
Yeah just use a closure for setting and getting? afterStateUpdated(fn($state, Closure $set) => $set('myInput', $state))
I've defined schema in my form like this:
Lets say my code looks like this (had to cut few things beacuse its too long but I think this should be enough)
Changing value of Section Name text input changes Test input value to test like It's expected to, but adding block in block builder doesnt trigger any change, maybe i've put afterStateUpdated and reactive in bad place?
Got ya, so it should be on the inputs really
But... you will have to pass the value up with say:
$set('./../Test',$state)