Support

Account

Home Forums Add-ons Repeater Field Dynamically generate subfield content when adding rows to a nested repeater Reply To: Dynamically generate subfield content when adding rows to a nested repeater

  • Hi John, thank you for your reply and for your suggestions. I had just written you an extensive reply and edited it because the images appeared as broken, and now it seems to have vanished, so I’m writing it again! 🙁

    I have changed the priority as advised, many thanks, however if I remove the extra depth in the nested repeaters, then my default Prices no longer appear. Instead, I get 19 Offers, all with empty Prices repeaters inside.

    If I start with my current code, including the extra array depth, then I get a sinlge Offer repeater, with it’s nested Prices repeater containing the desired 19 rows, all populated with the desired dates:

    Screen capture of the correct default values I'm getting inside the nested Prices repeater, which is inside the Offers repeater.

    This part works fine, so I understand that this part of the code is OK.

    My problem is that I want to be able to press the ADD (+) button on the parent Offers repeater, so that it adds a new row, when we will find that one of the contents of the row is the Prices repeater, which I was to appear populated by default with these same 19 rows and their contents.

    I’m guessing the only way to do this is going to be via jQuery, since I can’t alter the function of the ADD (+) button on the Offers repeater.

    Screen capture of the Alert I have managed to generate in jQuery, triggered by the correct Add Row Repeater button.

    I have managed to add a custom event to this exact button simply by locating it using jQuery and then I can make an Alert with an array of all the default values that I want to stick in the new Prices repeater, after it has added 19 rows to itself. I don’t even know if this is possible. I suspect it is, but very, very complicated. Any help is greatly appreciated!