-2

This question already has an answer here:

I have an ArcGIS JS API application where I have an "origin" combo box that must be populated for request type, in the following series of combo boxes I would like for a value to be chosen based on the 1st value.

If I have an e-waste item chosen in my request type box, I would like for the second series of boxes to contain an e-waste product before the request can be submitted. This holds true for the other request type values and the following series.

My initial code which does not allow a request to be submitted unless a value is chosen in the request type box is;

function ValicateRequestData() {
if (dijit.byId("cbRequestType").getValue() == "") {
    ShowSpanErrorMessage("spanServiceErrorMessage", messages.getElementsByTagName("spanErrorMsgType")[0].childNodes[0].nodeValue);
    return false;
}

if (dijit.byId("cbRequestType").getValue() == "") {
    ShowSpanErrorMessage("spanServiceErrorMessage", messages.getElementsByTagName("spanErrorMsgType")[0].childNodes[0].nodeValue);
    return false;
}

The above box populates with items such as bulky items, e-waste, etc.

I would then like a second box "cbMFEWASTE" to have a value required if e-waste is chosen in the above box before a request is submitted...

my application is based on the ArcGIS Public Info Center JS API App http://localgovtemplates2.esri.com/publicinfocenter/

marked as duplicate by PolyGeo Apr 17 '17 at 6:26

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

If your question is:

How do i check for the condition where one particular combobox has a value set and a second does not?

then the code would look something like this...

if (dijit.byId("cbRequestType").getValue() != "" && dijit.byId("cbRequestType").getValue() == "")
  //throw your error

if not, please elaborate. i agree with @blah238 that given your current explanation, the second question you've posted is a duplicate of the first.

Not the answer you're looking for? Browse other questions tagged or ask your own question.