Home Forums Feature Requests Repeater: Step Size Reply To: Repeater: Step Size

  • I don’t think this is something that I’d use. I don’t generally subscribe to creating absolute limits and go by this rule For example, what if on a medium size device you want to have rows of 2 instead of 3, before stacking them all on really small devices. I think that the developer would consider something like this an “edge case”.

    This could be done with some creative JavaScript. I have an example here that deletes and automatically creates rows in a repeater and this topic discusses adding a confirmation before deleting a layout in a flex field that could probably be adapted to a repeater field

    You could detect when a row is appended, count the current rows and then add enough to make it a number that is a multiple of the number you want. You could also probably detect when one is deleted, add a confirmation and then remove that number of rows. The problem here would be, which of the others to you delete. Your client might be pissed if you arbitrarily delete the ones they want to keep.

    A better (and probably simpler) solution might be to create an acf/validate_value filter for the repeater field and count the number of rows submitted and return an error if it does not match what is needed.