achilles_aditya
Nintex Newbie

Re: Repeating Conrol + Current user Name + Time

Jump to solution

Its failing in case of multiple rows.In case I have 4 rows and i am updating the third so on next page load it will update the textbox value of first two rows.For testing purpose I am binding currenttime instead of current user.The reason is that on page load it is taking the "valueTitleT " and "valueT" of the last row. I also got the same issue regarding the row instance  when I tried to apply JavaScript attribute to the repeating section control, Its getting applied only on the last row control

0 Kudos
Reply
achilles_aditya
Nintex Newbie

Re: Repeating Conrol + Current user Name + Time

Jump to solution

Parker Petty​ Thanks for your help.

What I did is once the user updates the comment at particular row I will make that row read only and by using below script I can update the particular row in which update take place .I have used a javascript to make rows visible to user according to some query string value so that one user can update only one row. But it will be better If you or me find the solution

  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) {

var checkvalue=$row.find(".userName input").val();

if(checkvalue !=" ")

{

if(checkvalue!=currentuse)

{

      $row.find(".userName input").val(currentUse);

      $row.find(".comment input").val(value);

$row.find(".title input").val(valueTitle);

     }

}

if(checkvalue==" ")

{

   $row.find(".userName input").val(currentUse);

      $row.find(".comment input").val(value);

$row.find(".title input").val(valueTitle);

}

}

   

   });

}

}

0 Kudos
Reply
pwp08a
Nintex Newbie

Re: Repeating Conrol + Current user Name + Time

Jump to solution

So I think I found a better solution.  same code I just added two variables to the function. .. add them in the calculated value:  user(currentRowNumber() , comment, Title, comment2, Title2)....only thing I see is when a new row is added it doesn't populate the username field, but it does when you modify a field in the row.

function user(rowNum, value, valueTitle, valueT, valueTitleT) {

   repeatingSection = NWF$('.myrepclass');

if (value != valueT || valueTitle != valueTitleT){

   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);

     }

   

   });

}

}

View solution in original post

Reply
achilles_aditya
Nintex Newbie

Re: Repeating Conrol + Current user Name + Time

Jump to solution

Parker Petty​ Thanks a lot for your help. According to the requirement the comment is to be modified only once so I am able to achieve that with my above code.

0 Kudos
Reply
kdelcastillo
Nintex Newbie

Re: Repeating Conrol + Current user Name + Time

Jump to solution

Another way to accomplish this without JavaScript is to use a calculated value field for the "Modified By" column called "ModifiedByUser" and for the formula add:

if(ModifiedByUser=="", Current User(Display Name), ModifiedByUser)

Same logic could be done with Modified as well. Works on SPOnline.

 

0 Kudos
Reply