Skip Ribbon Commands
Skip to main content
Lawyer Management System

Skip Navigation LinksDiscussions List : Ho to save repeater's rows in a different list
Use the Discussion list to hold forum-style conversations, including question and answer, on topics relevant to your team, project, or community.

  

Hi​ Dennis,

you could use the populateRepeaterFromList() function to do that, you could use the script manager to create the rule's script without the need to write any code.

Picture: Jim Hidson
  • Jim Hidson
2/22/2018 7:08 PM090
  

Hi Jim,
I have used this 2nd rule on several forms, and they work like a charm (off course).
One question I have on this topic is how we could manage to update  the repeater data afterwards without having the user to redirect to another form/list.  When I try it in the conventional way, I keep on running into rest-problems.


Thanks in advance

Picture: Dennis Mingeroet
  • Dennis Mingeroet
2/22/2018 3:08 PM089
  
You have two ways to do that:

 

The First Way)

By adding a custom button in the repeater row, in this button you can add a rule with type action event: onchange, and add the following script in it:

function addTheRow(){

var status=newListItem('/','Employee',['Title','EmpName','EmpNo','JobTitle'],[getValue(TextBox3),getValue(TextBox6),getValue(TextBox2),getValue(TextBox7)])

}

onClick(Button1,addTheRow())

 

The Second Way)

By adding a custom button outside the repeater to get all the rows data and save them in a list by looping through them. In order to do that follow the following steps:

Let's say you have four controls in the repeater [Title, Name, Num, Job]

  1. Create a [form variable] for each control [titleArray, nameArray, NumArray, JobArray]
  2. Add a rule on every control or put them together on one rule on the repetear with type action event: onchange with the following code:
    formVariableName=getRepeaterData(controlID)
    ie. titleArray= getRepeaterData(Title)
  3. In the custom button add a new rule with type action event: onchange with the following script:
function addAllRows(){

var titleArry=titleArray.split(',')

var nameArry=nameArray.split(',')

var NumArry=NumArray.split(',')

var JobArry=JobArray.split(',')

for(var i=0;i<titleArry.length;i++){

  var status=newListItem('/','Employee',['Title','EmpName','EmpNo','JobTitle'],[titleArry[i],nameArry[i],NumArry[i],JobArry[i]])

alert(status)

}

}

onClick(Button2,addAllRows())

 

This should do the job, take into consideration that alert(status) is to make sure that saving has been successfully done, you can replace it with if statement to show a custom success/fail messages.

 



Picture: Jim Hidson
  • Jim Hidson
11/6/2017 11:14 AM075