I refer to Vadim Tabakman blog about Numbering a Repeating Section and JavaScript events in Nintex Forms . But I find the number and field data is not right in Nintex 2013 Form. I check the JavaScript code and find function "NWF.FormFiller.Events.RegisterRepeaterRowAdded" and "NWF.FormFiller.Events.RegisterRepeaterRowDeleted" not working at all.
This code is working in Nintex 2010 form. But not working in Nintex 2013 form. Any one could help me?
The JavaScript code:
var rs = null;
NWF$(document).ready(function () {
rs = NWF$('.vtMyRepeatingSection');
window.setTimeout(doWork, 1000); // 1 seconds
});
function doWork() {
NWF$(rs).find('.cssFirstField').find('input').val('wombat');
NWF$(rs).find('.cssSecondField').find('input').val('koala');
fnAddNRows(0);
fnNumberRows();
}
function fnAddNRows(numRows) {
for (i = 0; i < numRows; i++) {
NWF$(rs).find('.ms-addnew').click();
}
}
function fnNumberRows() {
var iID = 0;
var labels = NWF$(rs).find('.vtLabel');
NWF$.each(labels, function (index) {
if (index == 0) NWF$(this).text(labels.length);
else NWF$(this).text(iID);
iID++;
});
}
//Not working
NWF.FormFiller.Events.RegisterRepeaterRowAdded(function () {
var repeaterRow = NWF$(arguments[0][0]);
if (NWF$(repeaterRow.parents('.nf-repeater')[0]).hasClass('vtMyRepeatingSection')) {
fnNumberRows();
NWF$(repeaterRow).find('.cssFirstField').find('input').val('wombat2');
NWF$(repeaterRow).find('.cssSecondField').find('input').val('koala2');
}
});
//not working
NWF.FormFiller.Events.RegisterRepeaterRowDeleted(function () {
var repeaterControl = NWF$(arguments[0][0]);
if (repeaterControl.hasClass('vtMyRepeatingSection')) {
fnNumberRows();
}
});