cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Drop Down cascading in repeating

Jump to solution

I have a repeating section with a drop down and I want to change options of this drop down with javascript. ( this repeating has a textbox too and when this textbox changes i want to change the drop down) how can I do this?

i have a variable options like below

options += "<option value='" + this.Id + "'>" + this.Title + "</option>";

i dont know how to find my drop down to append?

Labels: (1)
0 Kudos
Reply
4 Replies
Workflow Hero

Re: Drop Down cascading in repeating

Jump to solution

Hi,

 

Place some CSS class on your controls, e.g. "my-textbox" and "my-dropdown".

This JavaScript could help you.

 

NWF$(".nf-outer").on("change",".my-textbox",function()

{

  var dropdown = NWF$(this).parents(".nf-repeater-row").find(".my-dropdown"));

  ...

});

0 Kudos
Reply
Not applicable

Re: Drop Down cascading in repeating

Jump to solution

Hi,

I recently had one project with this tricky problem. Here is my solution:

function search(){

NWF$('.repSection .nf-repeater-row').each(function(index, element){

if (index > 0 && !NWF$(element).find('.Welder1 .nf-associated-control').val()) {

var WeldingProcess = NWF$(element).find('.WeldingProcess :selected').text();

var ProductType = NWF$(element).find('.ProductType :selected').text();

var TypeOfWeld = NWF$(element).find('.TypeOfWeld :selected').text();

var FillerMaterialGrouping = NWF$(element).find('.FillerMaterialGrouping :selected').text();

var FillerMaterialType = NWF$(element).find('.FillerMaterialType :selected').text();

var Thickness = NWF$(element).find('.Thickness .nf-associated-control').val();

var Diameter = NWF$(element).find('.Diameter .nf-associated-control').val();

var Branch = NWF$(element).find('.Branch .nf-associated-control').val();

var WeldingPosition = NWF$(element).find('.WeldingPosition :selected').text();

var WeldingDetail = NWF$(element).find('.WeldingDetail :selected').text();

//var Welder = NWF$(element).find('.Welder');

var Welder1 = NWF$(element).find('.Welder1 .nf-associated-control');

});

}

});

};

As you can see here i give a class name to rep section and iterate like in code above. Dropdown fields are with .text() endings and text boxes with .val() ending. From you post as i understand you dont need value but need to change values so you need fiorst get the object and then do some jQuery magic which you can find in internet tutorials

0 Kudos
Reply
Not applicable

Re: Drop Down cascading in repeating

Jump to solution

thnx. it works but everytime that i add a new row or even on form loading function goes on. I want that in works only on textbox or dropdown change. is there a solution to stop this?

0 Kudos
Reply
Workflow Hero

Re: Drop Down cascading in repeating

Jump to solution

To your needs, I think you could use "blur" instead of "change".

https://api.jquery.com/blur/

0 Kudos
Reply