dojo on.js TypeError matchesTarget未定义

时间:2016-08-07 02:19:45

标签: dojo

我正在努力扩展一些遗留的道场代码(v1.8)。我添加了一个按钮,当点击它时调用一个简单的句柄功能。问题是,单击按钮时没有任何反应,我在Firebug中收到以下错误:

TypeError: matchesTarget is undefined

Everthing之前工作过,我只添加了以下代码:

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);
  }
}

我一直在试着想出这个问题。请帮忙!

1 个答案:

答案 0 :(得分:1)

您需要添加dojo/query模块,以匹配其父节点button中的选择器submitBtn

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