User request to disable deletion and modification of the existing repeating section items. It should allow adding new rows, but no deletion and modification.
I wrote the code below. However, it has 2 issues
--1. It disabled the dropdown and single line fields as expected, but the code has no effect on the Date/Time field. I tried both prop('disabled', true) and attr('disabled','disabled') and none of them disabled the date field
--2. I thought the function call only execute once at the form loading time. However, when I clicked the 'Add New Row' button, the newly added row were disabled at well.
Here is the code
NWF$(document).ready(function() {
var isNewMode = document.location.pathname.indexOf("/NewForm.aspx") > -1;
var isDisplayMode = document.location.pathname.indexOf("/DispForm.aspx") > -1;
var isEditMode = document.location.pathname.indexOf("/EditForm.aspx") > -1;
if( isEditMode)
disableNWFRP();
});
function disableNWFRP(){
NWF$(".nf-RSPPolicy .nf-repeater-row:not('.nf-repeater-row-hidden')").each(function (){
var row = NWF$(this);
row.find(".nf-rs").prop('disabled', true);
//row.find(".nf-rs").attr('disabled','disabled')
row.find(".nf-repeater-deleterow-image").css('display', 'none');
});
}