Accessing checkbox field in repeating section using JavaScript

  • 20 October 2015
  • 4 replies
  • 5 views

Badge +3

Hi all,

I am trying to access checkbox field of each row in repeating section using JavaScript.

I have seen posts where the following command works for just one checkbox without repeating section:

   NWF$('#' + checkboxname).find('input[value='Checkbox Value']').prop('checked',true);

With repeating section below, how would the above line integrate with below?

NWF$(".RepeatingsectionClass .nf-repeater-row").each(function() {
  if(NWF$(this).find(".checkboxname"????????) ) { <----------------check if check value is Yes
    //  do something
  }
});

thanks again.


4 replies

Badge +9

Hi Brian

this is working for me:

NWF$(".my_repeating_section .nf-repeater-row .yes_no").each(function() {   console.log(NWF$(this).find('input').prop("checked"))  })

where my_repeating_section is CSS Class of Repeating Section Control and yes_no is CSS Class of Yes/No-Control.

Kind regards

Manfred

Badge +3

thanks for the reply Manfred. If I want to access another field on that specific repeating section row, how would I do that as that loop is on yes/no control?

Badge +9

For a Single Line Textcontrol (CSS Class Name) in Repeating Section:

NWF$(".my_repeating_section .nf-repeater-row .yes_no").each(function () {

    console.log(NWF$(this).find('input').prop("checked"));

    console.log(NWF$(this).closest(".nf-repeater-row").find(".Name input").val());

});

Badge +3

thanks! both solution worked well.

Reply