how to set a value of an input field using values in a repeater

I have this input fields inside a repeater, product name, price and quantity, and I have an input field total disabled by default outside of the repeater, I want to populate the result of foreach(price * quantity) inside the total field
Solution
myabe you can add the afterStateUpdated directly to the repeater instead of the input fields. Try using ->afterStateUpdated(fn ($state) => dd($state)) on the repeater and examine the results. It should be an array with all the items in the repeater. This will fire when you click the
add
action of the repeater and when you update items in the repeater. New empty items have a uuid key. But I imagine you can easily traverse the array, make calculatioins and set the value to the total. Let me know if that works
Was this page helpful?