Set the value of a repeatable Dropdown to another Dropdown which is also repeatable. | Community
Skip to main content
rakeshk21205956
Level 3
August 22, 2021
Solved

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

  • August 22, 2021
  • 2 replies
  • 1147 views

Sir,

Actual file link :  https://www.dropbox.com/s/0508by0lmlf77rc/repeatable%20Dropdown%20to%20another%20Dropdown%20which%20is%20also%20repeatable..pdf?dl=0

 

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 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by radzmar

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);
	}
}

2 replies

radzmar
Level 10
August 24, 2021

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);
}
rakeshk21205956
Level 3
August 25, 2021

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.

radzmar
radzmarAccepted solution
Level 10
August 25, 2021

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);
	}
}
rakeshk21205956
Level 3
August 26, 2021

Thanks a lot .  It is working ........