Get element of Forms Repeating section using jQuery

  • 20 March 2015
  • 5 replies
  • 65 views

Badge +1

Is there a way, how to get an input field, which is inside a repeating section, with jQuery?

Storing Cliend ID in a variable does not help, as the same "var" is assigned for all the repeated fields.

Perhaps there's a way how to determine the ID that's generated for each and every field?

ctl00_SPWebPartManager1_g_5f4ccd00_2da1_4ce1_b83e_a7adcfab8b88_ctl00_ListForm2_formFiller_FormView_ctl42_01641dee_38ca_42ee_9ee9_1d19f889520a_ctl01_ctl03_16117911_00d1_4a30_a4b7_4ae100d973e5


5 replies

Userlevel 6
Badge +16

I think you can set a css class to your input field and then query them on jquery

Badge +1

In this case they all will share the same class, however, I need to query each field separately.

The idea is that I want to have a jQuery-based solution that OnClick populates the input field with current datetime.

Badge +9

Hi Maris

see JavaScript events in Nintex Forms  from Emily Billing

Kind regards

Manfred

Userlevel 5
Badge +9

I agree with Manfred and Fernando, you can use the JavaScript events to execute a custom function each time a row is added with the repeater row added event. Then you can get the last row of the repeating section with jquery and get your datetime field via a custom css class that you can add to this control.

Hope this helps

Badge +5

Hi Maris,

In addition to the above, I've been able to wire up line specific control triggers following a blog post here.

Something similar to this:

NWF$('.EquipmentQuantity').change(function() {

  triggeringClassElement = this;
  NWF$(calculateEquipmentLineCost);
  NWF$(calculateEquipmentTotalCost);
});

and then

  • function calculateEquipmentLineCost(){
    var lineItemTotal = 0;

    var quantity = 0;
    var rate = 0;

    NWF$(triggeringClassElement).parents('.nf-repeater-row').children('.EquipmentQuantity').find('input').not('.nf-hidden-associated-control').not('.nocalc').each(function(i,n){
      quantity = isNaN(parseFloat(NWF$(n).val())) ? 0 : parseFloat(NWF$(n).val());
        });

The triggeringClassElement = this; is what helped me target the line and then the specific control within the line.

Reply