Я не мог остановить событие onClick
?Если я просто использую узел dom с событием onclick
, то dojo.stopEvent()
работает, но не с onClick
виджета.Я получаю сообщение об ошибке "Невозможно загрузить страницу ... статус 0" .Я обнаружил, что это происходит, когда страница обновляется во время выполнения вызова Ajax.Я публикую свой код.Любая помощь приветствуется
// create a button which will be replaced by the Button widget
var submitButton = dojo.create('button', {type:"submit", id:"submitButton"}, popupFormControlDiv);
var popupFormSubmitButton = new dijit.form.Button({label: "Create", type:"submit"}, "submitButton");
dojo.connect(popupFormSubmitButton, "onClick", function(event) {
//Stop the submit event since we want to control form submission.
event.preventDefault();
event.stopPropagation();
dojo.stopEvent(event);
// construct the arguments for the post request
var xhrArgs = {
form: popupForm,
url: "/admin/sys-config/registration-form/add",
handleAs: "text",
load: function(data) {
console.log("success");
},
error: function(error) {
console.log("error");
}
}
var deferred = dojo.xhrPost(xhrArgs);
});