cancel
Showing results for 
Search instead for 
Did you mean: 
furstlars
Nintex Newbie

How Do I Incorporate a Dropdown .change function() in the RegisterRepeaterRowDeleted function() ?

Can anyone assist with the following syntax so that after a repeating row is deleted, the dropdown change function continues to work? Highlighted for emphasis:

 

NWF.FormFiller.Events.RegisterAfterReady(function () {

NWF$(".nf-repeater-addrow").hide();
var BannerQuantityDDL = NWF$('#' + BannerQuantity);

BannerQuantityDDL.change(function () {

var BannerQuantityDDLVal = NWF$('#' + BannerQuantity).val();

   if (BannerQuantityDDLVal == "1") {
   NWF$(".nf-repeater-addrow").show();
   }

else {
   
   if (BannerQuantityDDLVal == "" || BannerQuantityDDLVal == "2") {
   NWF$(".nf-repeater-addrow").hide();
}};
});
});

NWF.FormFiller.Events.RegisterRepeaterRowDeleted (function () {

NWF$(".BannerRequirementsRepeater .nf-repeater-row:not('.nf-repeater-row-hidden')").each(function() {

var BannerQuantityCurrentVal = NWF$(this).find(".BannerQuantityClass select option:selected").val();

 if (BannerQuantityCurrentVal == "1") {
   NWF$(".nf-repeater-addrow").show();
}

else {

 if (BannerQuantityCurrentVal == "" || BannerQuantityCurrentVal == "2") {
   NWF$(".nf-repeater-addrow").hide();
}};
});
});

 

Labels: (1)
Tags (2)
0 Kudos
Reply
1 Reply
MegaJerk
Automation Master
Automation Master

Re: How Do I Incorporate a Dropdown .change function() in the RegisterRepeaterRowDeleted function()

There are a few things that are confusing to me, so I'd like to ask you for some clarification. If it is at all possible, it would also be helpful to actually a screenshot of the form / controls in question so that all of these variable names can be given some actual context. 

What is it that you would ultimately like to accomplish? You seem to be immediately hiding the Add New Row link, then you're setting up an onChange event on what is presumably a dropdown selector. 

When it fires, you're showing the Add New Row link if the value is (1), but hiding it any other time (assuming that there are no other options outside of "Nothing", "1", and "2"). 

You're also pushing a function into the RegisterRepeaterRowDeleted Nintex Form event that seems to look at all of the visible Rows left on the form, and then for each of those Rows finds, presumably, another dropdown selector (with the values of "Nothing", "1", "2"), and then hides or shows the Add New Row link based off of the value... but it does it for each row, so it doesn't make sense. 

are: 

NWF$('#' + BannerQuantity);

and 

NWF$(this).find(".BannerQuantityClass")


The same Control? 

If so, then you're initial event (onChange, aka: change()) isn't working because you're targeting a control inside of a Repeating Section using the ID ("#" + BannerQuantity, where 'BannerQuantity' is the ID of the control stored in a javascript variable via the settings panel on the control). An ID is meant to be unique, so every time there is a new row added to the Repeating Section, even though it is a copy of the same control, it is assigned a new unique ID rendering that means of targeting useless. 

You'll need to target the control using either a class (as you are doing in the RegisterRepeaterRowDeleted event), or by using the Control's Name (assuming that you have given the control a name via the Settings panel) and the attribute targeting code: 

NWF$("[data-controlname='WhateverYourControlNameIs']");


That is about as much as I can provide you with, with the information that is available to me now. Please do post more context. 

0 Kudos
Reply