I have an ArcGIS JavaScript API Web App that uses multiple combo boxes. I would like to create an if-else conditional statement between two fields in my feature layer. If one field is chosen in combo box one is 1 then combo box three should automatically populate to 3.
Below is my validate function for my request type.
function changeonevent() {
(dijit.byId("cbRequestType").on('change'), changeonevent (MFValue) {
if (MFValue == 'Electronic Waste') {
dijit.byID("cbMFSubType"). set ('value', 'Copy Machine');
} else if MFValue == '...'{
dijit.by.ID('cbMFSubType').set('value', 'Printer');
}
Answer
Sorry for the concise comment, I can elaborate here. Say foo
and bar
are your combo box dijits:
dijit.byId('foo').on('change', function (new_value) {
if (new_value == 'multi_family_refuse') {
dijit.byId('bar').set('value', 'bar value 1');
} else if (new_value == '...') {
dijit.byId('bar').set('value', 'bar value 2');
} else {
...
}
});
if you have a lot of various states, try using switch
statement instead.
Using your updated example:
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');
}
});
No comments:
Post a Comment