Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Change event when dropdown selection changes

Avatar

Level 1

I have several events that need to be executed based on the users selection in a drop down box.  The form has 4 subforms which are simple one row tables.  The drop down selections are model numbers.  If the user selects model 1, subform 1 and 2 should be visible only.  If the user selects model 2, only subform 3 and 4 should be visible.  If the user selects model 3 all four subforms should be visible.  If the the user selects model 4 all subforms should be invisible.  I created each of these actions in the dropdown field's change event.  However, there is something missing in my code between each event because when I change the model in the drop down box the previous selection's event is still there.


I've tried several attempts using:

  1. this.rawValue = xfa.event.newText;
  2. xfa.host.resetData();
  3. DropDownList2.setItems(myObj[this.boundItem(xfa.event.newText)]);
  4. this.setItems(EngSalesModel)[this.boundItem(xfa.event.newText)]; etc.

But cannot get them to work.  Here is a snippet of my code from my form:

if ($.boundItem(xfa.event.newText) == "1") {

  oTargetField = this.resolveNode("TEF");

  oTargetField.access = "readOnly";

  oTargetField = this.resolveNode("TEO");

  oTargetField.access = "readOnly";

  this.resolveNode("TEF.TEFtable1.TEFRow1.TEFModel").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("TEF.TEFtable1.TEFRow1.TEFmohr").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("TEF.TEFtable1.TEFRow1.TEFPrice").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("TEO.TEOtable2.TEORow1.TEOModel").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("TEO.TEOtable2.TEORow1.TEOType").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("TEO.TEOtable2.TEORow1.TEOMoHr").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("TEO.TEOtable2.TEORow1.TEOPrice").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

}

txtSelected.rawValue = xfa.event.newText;  

if ($.boundItem(xfa.event.newText) == "2") {

  oTargetField = this.resolveNode("TEF");

  oTargetField.access = "readOnly";

  this.resolveNode("TEF.TEFtable1.TEFRow1.TEFModel").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("TEF.TEFtable1.TEFRow1.TEFmohr").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("TEF.TEFtable1.TEFRow1.TEFPrice").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

 

    oTargetField = this.resolveNode("TEO");

  oTargetField.access = "readOnly";

  this.resolveNode("TEO.TEOtable2.TEORow1.TEOModel").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("TEO.TEOtable2.TEORow1.TEOType").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("TEO.TEOtable2.TEORow1.TEOMoHr").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("TEO.TEOtable2.TEORow1.TEOPrice").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

 

    oTargetField = this.resolveNode("MF");

  oTargetField.access = "readOnly";

  this.resolveNode("MF.MFTable3.MFRow1.MFModel").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("MF.MFTable3.MFRow1.MFPrice").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("MF.MFTable3.MFRow1.MFmohr").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

    

    oTargetField = this.resolveNode("MO");

  oTargetField.access = "readOnly";

  this.resolveNode("MO.MOTable4.MORow1.MOModel").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("MO.MOTable4.MORow1.MOType").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("MO.MOTable4.MORow1.MOMoHr").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

  this.resolveNode("MO.MOTable4.MORow1.MOPrice").ui.oneOfChild.border.fill.color.value = "192, 192, 192";

 

}

Any help would be greatly appreciated.  Thanks.

0 Replies