Setting Values in a repeater
Assume that I have a text field named maximum_quantity and a repeater with 2 fields each like this ['repeater' => ['quantity_per_year', 'title']]
How do I set the maximum_quantity value inside the repeater quantity_per_year?
6 Replies
Hi @captainjoker:
Sorry for formatting, but try somethung like this
It's just an array!
Hello @rickdb The repeater is dynamic in nature, this works if there are 2 but not less or more than 2
How do we change that?
Tbh, is setting a default value sufficient?
because then you can also just use
I do not think so
Build a loop, and count the quanities and remove that from the available quanity = max quanity
I have done it like this
foreach ($get('repeater') as $repeater){
$set($repeater['quantity_per_year'], $quantity_per_year);
}
but it is not setting the value