Expand my Community achievements bar.

SOLVED

Set the value of a repeatable Dropdown to another Dropdown which is also repeatable.

Avatar

Level 3

Sir,

Actual file link :  https://www.dropbox.com/s/0508by0lmlf77rc/repeatable%20Dropdown%20to%20another%20Dropdown%20which%20...

 

I have a Table of which Row2 is repeatable which contain a Dropdowns with options(1st column) & a Text field (2nd column).

 

Below that i have a Subform in which i have a another Dropdown which is blank with no option initially.

 

Now what I want is  suppose  user adds 4 rows in the table and from dropdown he selects suppose 

1st row -  Example 1 is selected

2nd row - Example 2 is selected 

3rd row - Example 3 is selected  

4th row - Example Other   is select and in the text field column they write "MYNAME"  (if other is selected then user has to fill the text field else text field i.e column 2 is blank)

 

now  in dropdown in the subform (again repeatable) below which is blank initially should be populated with the above options :
so the dropdown should have option as follows:

 Example 1

 Example 2

 Example 3

 Example Other - MYNAME

 

Also, duplicates should be avoided and if the user deletes any row the same value should be deleted from the dropdown as well.

 

Thanks 

@radzmar  @BrianKasingli   @ChitraMadan  @dcidev  

@_Bruce_Robertson

@Srini_Dhulipall 

 

 

1 Accepted Solution

Avatar

Correct answer by
Level 10

This requires just an if-else statement.

var oRows = Table1.resolveNodes('Row2.[Cell1 ne "  -Select-"]');
this.clearItems();
for (var i = 0; i < oRows.length; i += 1) {
	var oNode = oRows.item(i);
	if (oNode.Cell1.rawValue === "  Example Other Member" ) {
		this.addItem(oNode.Cell2.rawValue);
	} else {
		this.addItem(oNode.Cell1.rawValue);
	}
}

View solution in original post

4 Replies

Avatar

Level 10

This is quite easy to realize. Add this JavaScript in the enter event of the RB dropdown.

 

var oRows = Table1.resolveNodes('Row2.[Cell1 ne "  -Select-"]');
this.clearItems();
for (var i = 0; i < oRows.length; i += 1) {
	this.addItem(oRows.item(i).Cell1.rawValue);
}

Avatar

Level 3

No, it's not working... i mean its working for only the 1st part .. ie. when you select  options other than OTHER... when we select OTHER option  the dropdown should be populated with the text field value.

Avatar

Correct answer by
Level 10

This requires just an if-else statement.

var oRows = Table1.resolveNodes('Row2.[Cell1 ne "  -Select-"]');
this.clearItems();
for (var i = 0; i < oRows.length; i += 1) {
	var oNode = oRows.item(i);
	if (oNode.Cell1.rawValue === "  Example Other Member" ) {
		this.addItem(oNode.Cell2.rawValue);
	} else {
		this.addItem(oNode.Cell1.rawValue);
	}
}