• Resolved vi54

    (@vi54)


    Hello there. Love forminator!

    Is it possible to include a number field labeled ‘Amount’ that determines the number of entries in a repeater field?

    I have a repeater field listing names, and my client wants a number field labeled ‘Amount of people to register’ (let’s say 5) so that the repeater field generates 5 empty entries. How can I accomplish this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Saurabh – WPMU DEV Support

    (@wpmudev-support7)

    Hello @vi54

    Hope you’re doing well today! Thank you for reaching out to us.

    At the moment, you can limit the maximum repeater fields based on the “number” field out of the box in Forminator. For example, if the number field is set to 5, you will be able to add only 5 repeater fields.

    Here is how you can set the rule based on the number field
    Step 1 > Navigate to the form >> edit the field group
    https://monosnap.com/file/frjq4BIu4YxBiEfSdSPQzzLoKUEZhk

    Step 2 > Navigate to repeater field settings > set the “Maximum Repeater Limit” to Variable and select the “Number field”.
    https://monosnap.com/file/7Ny8t6hbrFINi7nTYG8gLjiTkrgNVV

    Here is a reference from our docs: https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#field-group-repeater

    However, in this approach, the visitor on the frontend will need to manually click on “add item” each time to add a repeater field until the number of repeater fields is equal to the “amount of people” set in the number field.

    Can you please confirm if you are looking to dynamically show all the repeater fields at once based on the number added?

    Like for example, if the amount of people is set to 5, then 5 repeater fields would be directly visible at once?

    Awaiting your response.

    Kind Regards,
    Saurabh

    Thread Starter vi54

    (@vi54)

    thank you. I do know about the min/max based on variables. But I do indeed mean:

    Can you please confirm if you are looking to dynamically show all the repeater fields at once based on the number added?

    • Yes I confirm the statement above

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @vi54,

    Can you please confirm if you are looking to dynamically show all the repeater fields at once based on the number added?

    • Yes I confirm the statement above

    By default, there isn’t any such feature in the plugin side, however, I’m checking with our developer to see if there are any suggestions that might be possible for such a setup.

    Will keep you posted once we get further feedback asap.

    Kind Regards,

    Nithin

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @vi54 ,

    Could you please check and see whether the following snippet helps?

    https://gist.github.com/wpmudev-sls/ad2cbe820049c5ab65f54e31c77bf614

    You’ll need to update the following line with your form ID in the code:
    if ( e.target.id == 'forminator-module-1609' ) {

    Suppose the form ID is 123, then the line will change as:
    if ( e.target.id == 'forminator-module-123' ) {

    The snippet works by targeting the field group ID ie:
    var group_options = $('#group-1 .forminator-grouped-fields').attr('data-options');

    So you’ll have to update #group-1 to your group ID.

    You can implement the above code using mu-plugins. Please check this link on how to implement the above code as a mu-plugins:
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Please do check and see how that goes.

    Kind Regards,

    Nithin

    Thread Starter vi54

    (@vi54)

    Thanks! Works good.

    Might be a great feature to add doesn’t it? I think a lot of people could benefit of the repeaterfield being guided by a number field.

    Plugin Support Dmytro – WPMU DEV Support

    (@wpmudevsupport16)

    Hello @vi54,

    We are pleased to hear that the PHP snippet works for you!

    As for changing the number of repeated groups based on the number field, could you please also check if you can achieve that by changing both the minimum and maximum values to your number field:
    https://prnt.sc/G7QYsjwsDGZJ

    – this might be the workaround without using a snippet.

    Best Regards,
    Dmytro

    Plugin Support Laura – WPMU DEV Support

    (@wpmudevsupport3)

    Hi @vi54,

    We haven’t heard from you in a while, I’ll go and mark this thread as resolved. Note that you can still reply on this topic.

    If you have any additional questions or require further help, please let us know!

    Best regards,
    Laura

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘X amount of repeater fields entries based on number field’ is closed to new replies.