Nintex for SharePoint Forum
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Title | Comment | Modified | Modified By |
---|---|---|---|
Test1 | Test1Comment | 6/6/2016 10:00:12 pm | user1 |
Test2 | Test2Comment | 7/6/2016 10:00:12 pm | user2 |
Test3 | Test3Comment | 9/6/2016 01:00:00 pm | user3 |
Test4 | Test4Comment | 11/6/2016 11:00:17 pm | user4 |
Hi ,
I have a nintex form with a repeating control having multiple rows. I want to track which user had done the update i.e. as in above table. I tried using the parameters "CurrentUser" and "Date" but it is modifying all the rows. How can I handle it?
Solved! Go to Solution.
Hi,
Could you trap the row added/deleted events in script and handle it that way?
NWF.FormFiller.Events.RegisterRepeaterRowAdded(function () {
});
NWF.FormFiller.Events.RegisterRepeaterRowDeleted(function () {
});
Jan
If that doesn't work try this. It should change the text field every time either comment or title is changed.
Add a calculated column outside the repeating section set to currentuser. Store the Client ID in JS variable as currentUser
inside the repeating section add a calculated column with this formula: user(currentRowNumber() , comment, Title) where comment and Tile are the names of the text boxes in the repeating section.
Add a text box with a css class userName.
Repeating section CSS class: myrepclass
Then paste this in JS
function user(rowNum, value, valueTitle) {
repeatingSection = NWF$('.myrepclass');
if (value != "" || valueTitle != ""){
var currentUse = NWF$('#' + currentUser).val();
NWF$(".myrepclass .nf-repeater-row").each(function(index){
var $row = NWF$(this); if( index == rowNum) {
$row.find(".userName input").val(currentUse); }
});
}
}
You can hide calculated column in CSS with display: none;
Let us know how the advice is working out for you, aditya gandhe, thanks!
I have done the following steps:
Following are the issues:
1. Once you get it fixed and working add a css class to the calculated column like hideMe. then add this in the CSS
.hideMe {
display: none;
}
2. add an alert in different places to see what is happening when you change the value.
After if( index == rowNum) { add this
alert(index);
alert(rowNum); see what is happening. it should only alert you when the rowNum from your function and index from for each are equal.
Did you make sure the css class is userName?
Paste from your form the JS bake to here to make sure it copied correctly.
Hi,
I have added the alerts and the script seems to be executing as " userName" textbox is showing the value of currentuser.
Since $row.find(".userName input").val(currentUse) takes the value from the calculated "currentuser field it changes dynamically depending upon the currentuser and the textboxes in all the rows shows the value of currentuser.I am getting the correct value of rownum but the values of currentuser gets updated
This should only change the row that you modified a field in. If you put the alerts after the If statement, you should only get 2 alerts and it should be the current row number.
You are only wanting to update one row correct?
The script is also getting executed on the page load due to which it is overwriting all the values. How can I avoid the script execution on page load?
Ah, forgive me, I cheated on my testing, I see the problem now. add two more single line text boxes in your repeating row with these properties
CSS class: comment hideMe ........ JS variable: commentTwo
CSS class: title hideMe ................JS Variable: titleTwo
Then replace your JS with this. This will compare the title and comment to previous values. If the same nothing happens...if different it will update the hidden text box and the username.
var valueT = NWF$('#' + commentTwo).val();
var valueTitleT = NWF$('#' +titleTwo).val();
function user(rowNum, value, valueTitle) {
repeatingSection = NWF$('.myrepclass');
if (value != valueT || valueTitle != valueTitleT){
alert("this ran");
var currentUse = NWF$('#' + currentUser).val();
NWF$(".myrepclass .nf-repeater-row").each(function(index){
var $row = NWF$(this); if( index == rowNum) {
$row.find(".userName input").val(currentUse);
$row.find(".comment input").val(value);
$row.find(".title input").val(valueTitle);
}
});
}
}