AnsweredAssumed Answered

Making dijit combo boxes required field

Question asked by geoffreywestgis on Oct 8, 2014

I would like two combo boxes to be required before submitting a request, so if one value is chosen in the origin box, two other combo boxes are required to submit the request. 

 

This allows for the type of request; if a certain request is chosen, say E-WASTE from this box, then before the user submits the request, the TYPE of e-waste must be required, in addition to the quantity.

 

All combo boxes reference the same layer. 

 

 

First block of code (taken from a related question) is somewhat of a start, where should the layer be reference to loop through and set the value of my E-Waste request type field?

 

Second block shows the function for populating the request type combo box, in this case E-WASTE is chosen from the second block of code and passed to the first.

 

 

 

 

 

 

dijit.byId("cbRequestType").on('change', function (EWASTEVALUE) {    
    if (EWASTEVALUE== 'E-WASTE') {    
    dijit.byID("cbEWASTE").set('value', '');     
    }      
    else if (MFValue == '...') {    
      dijit.by.ID('cbEWASTE').set('value', '');     
    }    
  });  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

function PopulateRequestTypesPriority(serviceRequestLayerFieldsPriority) {
   var serviceRequestFieldsPriority
   for (var i = 0; i < serviceRequestLayerFieldsPriority.length; i++) {
   if (serviceRequestLayerFieldsPriority[i].name == serviceRequestLayerInfo.RequestPriorityFieldName) {
       serviceRequestFieldsPriority = serviceRequestLayerFieldsPriority[i].domain.codedValues;
            break;
        }
    }


    var serviceRequestPriority = { identifier: "id", items: [] };
    for (var i = 0; i < serviceRequestFieldsPriority.length; i++) {
        serviceRequestFieldsPriority.items[i] = { id: serviceRequestFieldsPriority[i].name, name: serviceRequestFieldsPriority[i].name };
    }
    var serviceRequestStorePriority = new dojo.data.ItemFileReadStore({ data: serviceRequestTypesPriority });
    dijit.byId('cbRequestPriority').attr('store', serviceRequestStorePriority);
}
function PopulateRequestTypesPriority(serviceRequestLayerFields) {
    var serviceRequestFields
    for (var i = 0; i < serviceRequestLayerFields.length; i++) {
        if (serviceRequestLayerFields[i].name == serviceRequestLayerInfo.RequestPriorityFieldName) {
            serviceRequestFields = serviceRequestLayerFields[i].domain.codedValues;
            break;
      }
    }


    var serviceRequestTypes = { identifier: "id", items: [] };
    for (var i = 0; i < serviceRequestFields.length; i++) {
        serviceRequestTypes.items[i] = { id: serviceRequestFields[i].name, name: serviceRequestFields[i].name };
    }
    var serviceRequestStore = new dojo.data.ItemFileReadStore({ data: serviceRequestTypes });
    dijit.byId('cbRequestPriority').attr('store', serviceRequestStore);
}

Outcomes