dijit.byId("cbRequestType").on('change', function (MFValue) { if (MFValue == 'Electronic Waste') { dijit.byID("cbMFSubType").set('value', 'Copy Machine'); } else if MFValue == '...'{ dijit.by.ID('cbMFSubType').set('value', 'Printer'); } });
Geoffery,
Try placing your else if condition in parens
dijit.byId("cbRequestType").on('change', function (MFValue) { if (MFValue == 'Electronic Waste') { dijit.byID("cbMFSubType").set('value', 'Copy Machine'); } else if (MFValue == '...') { dijit.by.ID('cbMFSubType').set('value', 'Printer'); } });
So are you trying to set the Combobox selected value (i.e. the CB is already populated with values and you are just trying to set the selected value of the CB)?
I am getting back around to this, I am fairly novice with JavaScript. The code snippet above is ideal for my application, if E-WASTE is chosen in cbRequestType then cbEWASTE populates with different types of e-waste commodites. See my code below; what could be wrong with this that it does not pass to the combo box? I have a function which populates the e-waste combo box from the feature layer, should this be removed?
(dijit.byId("cbRequestType").on('change', function(MFValue) {
if (MFValue == 'E-WASTE') {
dijit.byID("cbEWASTE").set('value', 'Copy Machine');
}
else if (MFValue == '...') {
dijit.by.ID('cbEWASTE').set('value', 'Printer');
});
Thank you Robert.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.