Support

Account

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 https://en.wikipedia.org/wiki/Zero_one_infinity_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 https://github.com/Hube2/acf-dynamic-ajax-select-example/tree/master/dynamic-repeater-on-category and this topic discusses adding a confirmation before deleting a layout in a flex field that could probably be adapted to a repeater field https://support.advancedcustomfields.com/forums/topic/add-remove-field-confirmation-dialog/

    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 https://www.advancedcustomfields.com/resources/acf-validate_value/ for the repeater field and count the number of rows submitted and return an error if it does not match what is needed.