This can be done with relative ease.
You essentially have a table where each row stands for a possible configuration choice. The first item in a row is the configuration type, and the second and following items are the available options.
For your form, this translates into a 2-dimensional array, where each element of the main level is an array of the options for a given configuration type. As there are not many example items in the question, we will just call the items "item 1", "item 2", "configuration 1", "configuration 2" etc.
Now, for the implementation:
We first set up a document-level script, where we define the array, and then we also define the code to load the first dropdown, plus the function to load the second dropdown:
var confarr = new Array() ;
confarr[0] = ["select configuration","select item"] ;
confarr[1] = ["configuration 1","item 1","item 2","item 3"] ;
confarr[2] = ["configuration 2","item 4","item 5","item 6"] ;
// etc.
var coarr = new Array() ;
for (var c1 = 0 ; c1 < confarr.length ; c1++) {
coarr[c1] = [confarr[c1][0], c1] ;
}
this.getField("1-Configuration").setItems(coarr) ;
function loadRespType(ndx)
{
var rtarr = new Array() ;
rtarr[0] = ["select Respirator Type for " + confarr[ndx][0], 0]
for (var rt1 = 1 ; rt1 < confarr[ndx].length ; rt1++) {
rtarr[rt1] = [confarr[ndx][rt1], rt1]
}
this.getField("1-Respirator Type").clearItems() ;
this.getField("1-Respirator Type").setItems(rtarr) ;
}
In the Keystroke event of the field "1-Configuration", we add the following line of code:
if (!event.willCommit && event.changeEx > 0) { loadRespType(event.changeEx) }
And that should do it.
Note: It is possible that the field 1-Configuration does not load properly. This is a sign of timing issues, and to overcome this, you would delete the line
this.getField("1-Configuration").setItems(coarr) ;
from the document-level script, and add it to the PageOpen script of the opening page. If you have a multi-page form, you may in that case protect this line from being executed whenever you get to that page (a procedure which has been described several times in the past; if you can't find it, ask in a comment on how to do it).
Hope this can help.
Max Wyss.