Expand my Community achievements bar.

Compare multiple drop-down list selections then display message

Avatar

Level 2

Drop-Down List

Hello, I am building a dynamic form in LiveCycle designer; I am looking for ideas on how to compare multiple drop-down list selections.

I have 1 table with 28 rows each row has a different question and a dropdown menu. The dropdown menus are all the same listing A, B, C, D, E, F and G.

My issue is that I want to compare those selections and then populate either a message box, check box or radio selection based on the following criteria.

If only A’s are selected show message/select 1

If only A’s and B’s are selected show message/select 2

If a combination of A’s, B’s, C’s, D’s, E’s, F’s and G’s show message/select 3

Note: currently each row is not required to be answered

Any help is much appreciated.

2 Replies

Avatar

Level 8

Try this:

var aList=[];
for (var a=0;a<Table1._Row.count;a++){//Your dynamic row location
myDD = Table1.Row.all.item(a).DropDownList1;//Drop down location
if (!myDD.isNull && aList.indexOf(myDD.rawValue)==-1)
  aList.push(myDD.rawValue);
}
if (aList.length==1 && aList.indexOf("A")!=-1)
xfa.host.messageBox("Only As!");
if (aList.length==2 && aList.indexOf("A")!=-1 && aList.indexOf("B")!=-1)
xfa.host.messageBox("Only As and Bs!");
if (aList.length==7)
xfa.host.messageBox("All letters have been selected!");

Kyle

Avatar

Level 2

Hi,  thank you for the help.

The code is only working for the 1st Row. How do I loop it through all populated rows?