Support

Account

Home Forums Add-ons Repeater Field Fixing Number Of Repeater Rows With Dropdown?

Solving

Fixing Number Of Repeater Rows With Dropdown?

  • I would like to be able to fix the min and max (so they are the same) by using a drop down field. So basically you could be presented with:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10

    As options in a drop down menu, and then this would automatically display the set number of rows. I can easily hide the existing Add Row button with a bit of jQuery, but I wasn’t sure how to go about forcing the max and min row variables from the value of the drop down.

    It looks like the row count variables are being utilised in input.js, but I just couldn’t figure out how it was working in order to plug into this.

  • Hi @Peter Willis

    I would write some JS code to listen for a change on the select field, and then trigger a click on the repeater field’s ‘add new row’ button x amount of times.

    Then, you can set the data-min and data-max attributes on the repeater field element for ACF to handle the min / max validation.

    Please use firebug to see these attributes clearly.

    Thanks
    E

  • Elliot

    Even when i do the change in data-min and data-max attributes in repeater DOM, nothing change.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Fixing Number Of Repeater Rows With Dropdown?’ is closed to new replies.