Greg Davis
Greg Davis

Reputation: 13

dojo on.js TypeError matchesTarget is undefined

I'm working to extend some legacy dojo code (v1.8). I added a button which when clicked calls a simple handle function. The problem is, nothing happens when I click the button and I get the following error in Firebug:

TypeError: matchesTarget is undefined

Everthing worked before, and I only added the following code:

require(["dojo/on"], function (on) {
  on(document.getElementById("submitBtn"), "button:click", function (e) {
    onSubmitQuery();
  });
});

onSubmitQuery:function () {
  var model_type_uuid = document.getElementById("modelTypeSelect").get('value');
  // check to see if model_type_uuid is not undefined before submitting
  if (model_type_uuid === undefined || model_type_uuid == "00000000-0000-0000-0000-000000000000") {
    alert('Invalid Decision Model Type ' + model_type_uuid + ' for Decision Query submission');
    return;
  }
  if (document.getElementByID("modeSelector").get('value') == "simulate") {
    submitStandingQuery(model_type_uuid);
  } else {
    submitInteractiveQuery(model_type_uuid);
  }
}

I've been pulling my hair out trying to figure this out. Please help!

Upvotes: 1

Views: 106

Answers (1)

aichao
aichao

Reputation: 7445

You need to add the dojo/query module in order to match the selector button within its parent node submitBtn.

require(["dojo/on", "dojo/query"], function (on) {
  on(document.getElementById("submitBtn"), "button:click", function (e) {
    onSubmitQuery();
  });
});

Upvotes: 1

Related Questions