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

Need a uncheck yes/no control in repeat section

Jump to solution

Hi,

I need to uncheck all the the yes/no control in repeat section using JavaScript. The idea is to select only one row from many.

Need to uncheck all except the last selected.

Any Help

Thanks

Sojan

Labels: (1)
0 Kudos
Reply
7 Replies
Highlighted
Nintex Newbie

Re: Need a uncheck yes/no control in repeat section

Jump to solution

Give your repeating section the class:  myrepclasss

Give your check box the class: checkbox in both locations below

Add a calculated field in your repeating row with this formula:  uncheck(currentRowNumber(), checkBox)

where checkbox is the name of the checkbox in your repeating section.

This JavaScript will uncheck all but the last checked:

function uncheck(rowNum, value) {

repeatingSection = NWF$('.myrepclasss');
if (value != ""){

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

    var $row = NWF$(this);

    if( index == rowNum-1) {
    }
    else {
     $row.find(".checkBox input").attr('checked', false);
    }
   });
}
}

View solution in original post

Reply
Highlighted
Nintex Newbie

Re: Need a uncheck yes/no control in repeat section

Jump to solution

Wonderful! Parker, It worked. Thanks for the help. Really appreciated

Sojan

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Need a uncheck yes/no control in repeat section

Jump to solution

Hi Parker,

Any idea why it is not working when we remove a row and try the check box, the check  box is not getting checked.

Thanks

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Need a uncheck yes/no control in repeat section

Jump to solution

Ah, didn't test that....try this:

function uncheck(rowNum, value) { repeatingSection = NWF$('.myrepclasss');

if (value != ""){

//removed exclusion for hidden rows which I guess is how they handle removal of rows

     NWF$(".myrepclasss .nf-repeater-row").each(function(index){

  var $row = NWF$(this);

  if( index == rowNum) {

    }

    else {

     $row.find(".checkBox input").attr('checked', false);

    }

   });

}

}

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Need a uncheck yes/no control in repeat section

Jump to solution

Hi Parker,

It unchecked all the rows, and the selected one (the last selection) is also unchecked.

Regards,

sojan

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Need a uncheck yes/no control in repeat section

Jump to solution

I'm not experiencing that on my test form?  you may have to throw some alerts in there to see what is happening and maybe tweak it a little.

0 Kudos
Reply
Highlighted
Nintex Newbie

Re: Need a uncheck yes/no control in repeat section

Jump to solution

Hi Parker,

Don't  know how it works for you, but got the issue.

When looping through all the rows (including hidden rows), the starting index change from 0 to 1.

So I changed the condition check from if(index == rowNum-1) to if(index == rowNum)

function uncheck(rowNum, value) {

repeatingSection = NWF$('.SuppRepclass');

if (value){ //We need to check the boolean value

   NWF$(".SuppRepclass .nf-repeater-row").each(function(index){

    var $row = NWF$(this);

    if( index == rowNum) { //the check has to be exact row number.

    }

    else {

     $row.find(".Selecter-Box input").attr('checked', false);

    }

   });

}

}

Thanks

Reply