1
0
-1

I'm trying to use  Util.addRepeatContent(data.templates , nodeArr)   but can't find how to structure nodeArr. 

I have a simple repeat with a link inside and I would like to update the name and Link URL properties. 

Kind Regards

Kev

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      The first parameter needs to be the repeat item not the repeat data.

      Use the Form.getItemFromPath method or use Form.items to access the repeat item.

      The nodeArr parameter needs to be an array of objects.

      The object keys need to be the same as the ids of the fields in the repeat.

       

      For example:

      var nodeArr = [
      	{
       	"firstName": "David",
       	"lastName": "Moore"
      	},
      	{
      	 "firstName": "Kevin",
      	 "lastName": "Mortimer"
      	}
      ];
       
      Util.addRepeatContent(Form.getItemFromPath("data.templates"), nodeArr);

      This would add two instances to the repeat with the firstName and lastName data for each instance.

      I will update the API doc to be more informative. 

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Has there been an update to the API for this as the exmaple no longer works and returns 

        Error: Parameter repeatItem must be a repeat
        at e.addRepeatContent (<anonymous>:2161:51413)
        at Rules.click_button (<anonymous>:1017:6)
        at fn (eval at compile (:794:126), <anonymous>:4:670)
        at b (<anonymous>:685:128)
        at e (<anonymous>:839:195)
        at m.$eval (<anonymous>:704:293)
        at m.$apply (<anonymous>:705:17)
        at HTMLButtonElement.<anonymous> (<anonymous>:839:247)
        at HTMLButtonElement.dispatch (<anonymous>:5:6466)
        at HTMLButtonElement.r.handle (<anonymous>:5:3241)

          CommentAdd your comment...