diff --git a/src/addon/calendar/pages/edit-event/edit-event.ts b/src/addon/calendar/pages/edit-event/edit-event.ts
index fe80b521b..5de3c1fe2 100644
--- a/src/addon/calendar/pages/edit-event/edit-event.ts
+++ b/src/addon/calendar/pages/edit-event/edit-event.ts
@@ -497,7 +497,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
this.calendarProvider.submitEvent(this.eventId, data).then((result) => {
event = result.event;
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, result.sent, this.currentSite.getId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, result.sent, this.currentSite.getId());
if (result.sent) {
// Event created or edited, invalidate right days & months.
@@ -561,7 +561,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
this.domUtils.showConfirm(this.translate.instant('core.areyousure')).then(() => {
this.calendarOffline.deleteEvent(this.eventId).then(() => {
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.currentSite.getId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.currentSite.getId());
this.returnToList();
}).catch(() => {
@@ -584,7 +584,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
}
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.currentSite.getId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.currentSite.getId());
}
/**
diff --git a/src/addon/mod/assign/pages/edit-feedback-modal/edit-feedback-modal.ts b/src/addon/mod/assign/pages/edit-feedback-modal/edit-feedback-modal.ts
index 5ea771319..2ebb374f6 100644
--- a/src/addon/mod/assign/pages/edit-feedback-modal/edit-feedback-modal.ts
+++ b/src/addon/mod/assign/pages/edit-feedback-modal/edit-feedback-modal.ts
@@ -71,7 +71,7 @@ export class AddonModAssignEditFeedbackModalPage {
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
}
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
/**
@@ -92,7 +92,7 @@ export class AddonModAssignEditFeedbackModalPage {
e.preventDefault();
e.stopPropagation();
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
// Close the modal, sending the input data.
this.forceLeave = true;
diff --git a/src/addon/mod/assign/pages/edit/edit.ts b/src/addon/mod/assign/pages/edit/edit.ts
index 4ec6fe6d2..87eb9ee29 100644
--- a/src/addon/mod/assign/pages/edit/edit.ts
+++ b/src/addon/mod/assign/pages/edit/edit.ts
@@ -99,7 +99,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy {
// Nothing has changed or user confirmed to leave. Clear temporary data from plugins.
this.assignHelper.clearSubmissionPluginTmpData(this.assign, this.userSubmission, this.getInputData());
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
/**
@@ -318,7 +318,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy {
await this.assignHelper.clearSubmissionPluginTmpData(this.assign, this.userSubmission, inputData);
// Submission saved, trigger events.
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, sent, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, sent, this.sitesProvider.getCurrentSiteId());
const params = {
assignmentId: this.assign.id,
diff --git a/src/addon/mod/data/pages/edit/edit.ts b/src/addon/mod/data/pages/edit/edit.ts
index 20a58c60c..a830e02d8 100644
--- a/src/addon/mod/data/pages/edit/edit.ts
+++ b/src/addon/mod/data/pages/edit/edit.ts
@@ -114,7 +114,7 @@ export class AddonModDataEditPage {
const files = await this.dataHelper.getEditTmpFiles(inputData, this.fieldsArray, this.data.id, this.entry.contents);
this.fileUploaderProvider.clearTmpFiles(files);
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
}
/**
@@ -215,7 +215,7 @@ export class AddonModDataEditPage {
// This is done if entry is updated when editing or creating if not.
if ((this.entryId && result.updated) || (!this.entryId && result.newentryid)) {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, result.sent, this.siteId);
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, result.sent, this.siteId);
const promises = [];
diff --git a/src/addon/mod/data/pages/search/search.ts b/src/addon/mod/data/pages/search/search.ts
index 4d2263630..3b9ab3953 100644
--- a/src/addon/mod/data/pages/search/search.ts
+++ b/src/addon/mod/data/pages/search/search.ts
@@ -187,9 +187,9 @@ export class AddonModDataSearchPage {
*/
closeModal(data?: any): void {
if (typeof data == 'undefined') {
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
} else {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
}
this.viewCtrl.dismiss(data);
diff --git a/src/addon/mod/forum/components/post/post.ts b/src/addon/mod/forum/components/post/post.ts
index 997e8a015..cf4354222 100644
--- a/src/addon/mod/forum/components/post/post.ts
+++ b/src/addon/mod/forum/components/post/post.ts
@@ -109,9 +109,9 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
* Detect changes on input properties.
*/
ngOnChanges(changes: {[name: string]: SimpleChange}): void {
- if (changes.leavingPage && this.leavingPage && this.formElement) {
+ if (changes.leavingPage && this.leavingPage) {
// Download all courses is enabled now, initialize it.
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
}
@@ -423,7 +423,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
this.onPostChange.emit();
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, sent, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, sent, this.sitesProvider.getCurrentSiteId());
if (this.syncId) {
this.syncProvider.unblockOperation(AddonModForumProvider.COMPONENT, this.syncId);
@@ -443,7 +443,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
// Reset data.
this.setReplyFormData();
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
if (this.syncId) {
this.syncProvider.unblockOperation(AddonModForumProvider.COMPONENT, this.syncId);
diff --git a/src/addon/mod/forum/pages/edit-post/edit-post.ts b/src/addon/mod/forum/pages/edit-post/edit-post.ts
index 5b5a0cd17..152d15077 100644
--- a/src/addon/mod/forum/pages/edit-post/edit-post.ts
+++ b/src/addon/mod/forum/pages/edit-post/edit-post.ts
@@ -120,9 +120,9 @@ export class AddonModForumEditPostPage {
*/
closeModal(data: any, ): void {
if (data) {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
} else {
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
this.viewCtrl.dismiss(data);
diff --git a/src/addon/mod/forum/pages/new-discussion/new-discussion.ts b/src/addon/mod/forum/pages/new-discussion/new-discussion.ts
index c41f0153f..d9951cc49 100644
--- a/src/addon/mod/forum/pages/new-discussion/new-discussion.ts
+++ b/src/addon/mod/forum/pages/new-discussion/new-discussion.ts
@@ -480,8 +480,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy {
this.domUtils.showErrorModalDefault(null, 'addon.mod_forum.errorposttoallgroups', true);
}
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!discussionIds,
- this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, !!discussionIds, this.sitesProvider.getCurrentSiteId());
this.returnToDiscussions(discussionIds, discTimecreated);
}).catch((message) => {
@@ -504,7 +503,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy {
}));
return Promise.all(promises).then(() => {
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
this.returnToDiscussions();
});
@@ -539,7 +538,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy {
this.uploaderProvider.clearTmpFiles(this.newDiscussion.files);
if (this.formElement) {
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
}
diff --git a/src/addon/mod/glossary/pages/edit/edit.ts b/src/addon/mod/glossary/pages/edit/edit.ts
index c8b252a4c..5bc201f8c 100644
--- a/src/addon/mod/glossary/pages/edit/edit.ts
+++ b/src/addon/mod/glossary/pages/edit/edit.ts
@@ -160,7 +160,7 @@ export class AddonModGlossaryEditPage implements OnInit {
// Delete the local files from the tmp folder.
this.uploaderProvider.clearTmpFiles(this.attachments);
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
/**
@@ -253,8 +253,7 @@ export class AddonModGlossaryEditPage implements OnInit {
};
this.eventsProvider.trigger(AddonModGlossaryProvider.ADD_ENTRY_EVENT, data, this.sitesProvider.getCurrentSiteId());
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!entryId,
- this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, !!entryId, this.sitesProvider.getCurrentSiteId());
this.saved = true;
this.navCtrl.pop();
diff --git a/src/addon/mod/lesson/components/index/index.ts b/src/addon/mod/lesson/components/index/index.ts
index 23ad87ae6..c8c4fb1ed 100644
--- a/src/addon/mod/lesson/components/index/index.ts
+++ b/src/addon/mod/lesson/components/index/index.ts
@@ -586,7 +586,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
this.refreshIcon = 'refresh';
this.syncIcon = 'sync';
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true, this.siteId);
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, true, this.siteId);
});
}
diff --git a/src/addon/mod/lesson/pages/password-modal/password-modal.ts b/src/addon/mod/lesson/pages/password-modal/password-modal.ts
index 2446bb266..03278e4c0 100644
--- a/src/addon/mod/lesson/pages/password-modal/password-modal.ts
+++ b/src/addon/mod/lesson/pages/password-modal/password-modal.ts
@@ -44,7 +44,7 @@ export class AddonModLessonPasswordModalPage {
e.preventDefault();
e.stopPropagation();
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss(password.value);
}
@@ -53,7 +53,7 @@ export class AddonModLessonPasswordModalPage {
* Close modal.
*/
closeModal(): void {
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss();
}
diff --git a/src/addon/mod/lesson/pages/player/player.ts b/src/addon/mod/lesson/pages/player/player.ts
index 44d2a87ca..d8fa3b011 100644
--- a/src/addon/mod/lesson/pages/player/player.ts
+++ b/src/addon/mod/lesson/pages/player/player.ts
@@ -149,7 +149,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy {
}
}
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
/**
@@ -552,8 +552,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy {
return this.callFunction(this.lessonProvider.processPage.bind(this.lessonProvider), args, 6, 8).then((result) => {
if (formSubmitted) {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, result.sent,
- this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, result.sent, this.sitesProvider.getCurrentSiteId());
}
if (!this.offline && !this.review && this.lessonProvider.isLessonOffline(this.lesson)) {
diff --git a/src/addon/mod/quiz/pages/player/player.ts b/src/addon/mod/quiz/pages/player/player.ts
index a7ebca6af..908918fbf 100644
--- a/src/addon/mod/quiz/pages/player/player.ts
+++ b/src/addon/mod/quiz/pages/player/player.ts
@@ -154,9 +154,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy {
await this.domUtils.showConfirm(this.translate.instant('addon.mod_quiz.confirmleavequizonerror'));
- if (this.formElement) {
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
- }
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
} finally {
modal.dismiss();
}
@@ -592,8 +590,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy {
this.autoSave.hideAutoSaveError();
if (this.formElement) {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !this.offline,
- this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, !this.offline, this.sitesProvider.getCurrentSiteId());
}
});
}
diff --git a/src/addon/mod/quiz/pages/preflight-modal/preflight-modal.ts b/src/addon/mod/quiz/pages/preflight-modal/preflight-modal.ts
index fa149c30f..794b15b8e 100644
--- a/src/addon/mod/quiz/pages/preflight-modal/preflight-modal.ts
+++ b/src/addon/mod/quiz/pages/preflight-modal/preflight-modal.ts
@@ -120,7 +120,7 @@ export class AddonModQuizPreflightModalPage implements OnInit {
this.domUtils.showErrorModal('core.errorinvalidform', true);
}
} else {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.siteId);
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.siteId);
this.viewCtrl.dismiss(this.preflightForm.value);
}
@@ -130,7 +130,7 @@ export class AddonModQuizPreflightModalPage implements OnInit {
* Close modal.
*/
closeModal(): void {
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
this.viewCtrl.dismiss();
}
diff --git a/src/addon/mod/wiki/pages/edit/edit.ts b/src/addon/mod/wiki/pages/edit/edit.ts
index 7cd65dccb..01edf08ae 100644
--- a/src/addon/mod/wiki/pages/edit/edit.ts
+++ b/src/addon/mod/wiki/pages/edit/edit.ts
@@ -356,7 +356,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy {
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
}
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
}
/**
@@ -426,8 +426,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy {
// Edit existing page.
promise = this.wikiProvider.editPage(this.pageId, text, this.section).then(() => {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true,
- this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, true, this.sitesProvider.getCurrentSiteId());
// Invalidate page since it changed.
return this.wikiProvider.invalidatePage(this.pageId).then(() => {
@@ -463,8 +462,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy {
return this.wikiProvider.newPage(title, text, this.subwikiId, wikiId, this.userId, this.groupId).then((id) => {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, id > 0,
- this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, id > 0, this.sitesProvider.getCurrentSiteId());
if (id > 0) {
// Page was created, get its data and go to the page.
diff --git a/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.ts b/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.ts
index a0121dee6..0eda6bceb 100644
--- a/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.ts
+++ b/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.ts
@@ -304,7 +304,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit {
assessmentData, false, allowOffline);
}).then((grade) => {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!grade, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, !!grade, this.sitesProvider.getCurrentSiteId());
const promises = [];
diff --git a/src/addon/mod/workshop/pages/assessment/assessment.ts b/src/addon/mod/workshop/pages/assessment/assessment.ts
index 09be157c7..5cc584349 100644
--- a/src/addon/mod/workshop/pages/assessment/assessment.ts
+++ b/src/addon/mod/workshop/pages/assessment/assessment.ts
@@ -132,7 +132,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy {
// Show confirmation if some data has been modified.
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
}
/**
@@ -346,7 +346,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy {
return this.workshopProvider.evaluateAssessment(this.workshopId, this.assessmentId, this.courseId, inputData.text,
inputData.weight, inputData.grade).then((result) => {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!result, this.siteId);
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, !!result, this.siteId);
const data = {
workshopId: this.workshopId,
diff --git a/src/addon/mod/workshop/pages/edit-submission/edit-submission.ts b/src/addon/mod/workshop/pages/edit-submission/edit-submission.ts
index 0911dc7d0..809419793 100644
--- a/src/addon/mod/workshop/pages/edit-submission/edit-submission.ts
+++ b/src/addon/mod/workshop/pages/edit-submission/edit-submission.ts
@@ -128,7 +128,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy {
this.fileUploaderProvider.clearTmpFiles(this.submission.attachmentfiles);
}
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
}
/**
@@ -374,7 +374,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy {
attachmentsId, undefined, submissionId, allowOffline);
}).then((newSubmissionId) => {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!newSubmissionId, this.siteId);
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, !!newSubmissionId, this.siteId);
const data = {
workshopId: this.workshopId,
diff --git a/src/addon/mod/workshop/pages/submission/submission.ts b/src/addon/mod/workshop/pages/submission/submission.ts
index 947aec803..aab6470db 100644
--- a/src/addon/mod/workshop/pages/submission/submission.ts
+++ b/src/addon/mod/workshop/pages/submission/submission.ts
@@ -153,7 +153,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy {
// Show confirmation if some data has been modified.
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
}
/**
@@ -449,7 +449,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy {
return this.workshopProvider.evaluateSubmission(this.workshopId, this.submissionId, this.courseId, inputData.text,
inputData.published, inputData.grade).then((result) => {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!result, this.siteId);
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, !!result, this.siteId);
const data = {
workshopId: this.workshopId,
diff --git a/src/addon/notes/pages/add/add.ts b/src/addon/notes/pages/add/add.ts
index 64459dd0a..5a896c432 100644
--- a/src/addon/notes/pages/add/add.ts
+++ b/src/addon/notes/pages/add/add.ts
@@ -65,7 +65,7 @@ export class AddonNotesAddPage {
this.processing = true;
this.notesProvider.addNote(this.userId, this.courseId, this.type, this.text).then((sent) => {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, sent, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, sent, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss({type: this.type, sent: true}).finally(() => {
this.domUtils.showToast(sent ? 'addon.notes.eventnotecreated' : 'core.datastoredoffline', true, 3000);
@@ -82,7 +82,7 @@ export class AddonNotesAddPage {
* Close modal.
*/
closeModal(): void {
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss({type: this.type});
}
diff --git a/src/components/local-file/local-file.ts b/src/components/local-file/local-file.ts
index d430af3f4..c9f63ed17 100644
--- a/src/components/local-file/local-file.ts
+++ b/src/components/local-file/local-file.ts
@@ -143,7 +143,7 @@ export class CoreLocalFileComponent implements OnInit {
if (newName == this.file.name) {
// Name hasn't changed, stop.
this.editMode = false;
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
return;
}
@@ -160,8 +160,7 @@ export class CoreLocalFileComponent implements OnInit {
// File doesn't exist, move it.
return this.fileProvider.moveFile(this.relativePath, newPath).then((fileEntry) => {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false,
- this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
this.editMode = false;
this.file = fileEntry;
diff --git a/src/components/send-message-form/send-message-form.ts b/src/components/send-message-form/send-message-form.ts
index 05a3de17f..ee2e59116 100644
--- a/src/components/send-message-form/send-message-form.ts
+++ b/src/components/send-message-form/send-message-form.ts
@@ -90,7 +90,7 @@ export class CoreSendMessageFormComponent implements OnInit {
this.message = ''; // Reset the form.
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
value = this.textUtils.replaceNewLines(value, '
');
this.onSubmit.emit(value);
diff --git a/src/core/comments/pages/add/add.ts b/src/core/comments/pages/add/add.ts
index 826d642fc..151eaa220 100644
--- a/src/core/comments/pages/add/add.ts
+++ b/src/core/comments/pages/add/add.ts
@@ -71,8 +71,7 @@ export class CoreCommentsAddPage {
this.commentsProvider.addComment(this.content, this.contextLevel, this.instanceId, this.componentName, this.itemId,
this.area).then((commentsResponse) => {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!commentsResponse,
- this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, !!commentsResponse, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss({comments: commentsResponse}).finally(() => {
this.domUtils.showToast(commentsResponse ? 'core.comments.eventcommentcreated' : 'core.datastoredoffline', true,
@@ -90,7 +89,7 @@ export class CoreCommentsAddPage {
* Close modal.
*/
closeModal(): void {
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss();
}
}
diff --git a/src/core/course/providers/helper.ts b/src/core/course/providers/helper.ts
index ad29690ee..7fbc8b740 100644
--- a/src/core/course/providers/helper.ts
+++ b/src/core/course/providers/helper.ts
@@ -1258,7 +1258,7 @@ export class CoreCourseHelperProvider {
} else {
modal.dismiss();
- return this.getAndOpenCourse(undefined, courseId, params, siteId);
+ return this.getAndOpenCourse(navCtrl, courseId, params, siteId);
}
}).catch((error) => {
modal.dismiss();
diff --git a/src/core/courses/pages/self-enrol-password/self-enrol-password.ts b/src/core/courses/pages/self-enrol-password/self-enrol-password.ts
index 7e0080248..17da104ae 100644
--- a/src/core/courses/pages/self-enrol-password/self-enrol-password.ts
+++ b/src/core/courses/pages/self-enrol-password/self-enrol-password.ts
@@ -39,7 +39,7 @@ export class CoreCoursesSelfEnrolPasswordPage {
* Close help modal.
*/
close(): void {
- this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss();
}
@@ -53,7 +53,7 @@ export class CoreCoursesSelfEnrolPasswordPage {
e.preventDefault();
e.stopPropagation();
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
this.viewCtrl.dismiss(password);
}
diff --git a/src/core/login/pages/credentials/credentials.ts b/src/core/login/pages/credentials/credentials.ts
index 0f1734f9e..5c2d5909e 100644
--- a/src/core/login/pages/credentials/credentials.ts
+++ b/src/core/login/pages/credentials/credentials.ts
@@ -246,7 +246,7 @@ export class CoreLoginCredentialsPage {
}).finally(() => {
modal.dismiss();
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
});
}
diff --git a/src/core/login/pages/email-signup/email-signup.ts b/src/core/login/pages/email-signup/email-signup.ts
index f4cc08996..62121f94b 100644
--- a/src/core/login/pages/email-signup/email-signup.ts
+++ b/src/core/login/pages/email-signup/email-signup.ts
@@ -277,7 +277,7 @@ export class CoreLoginEmailSignupPage {
}).then((result) => {
if (result.success) {
- this.domUtils.triggerFormSubmittedEvent(this.signupFormElement.nativeElement, true);
+ this.domUtils.triggerFormSubmittedEvent(this.signupFormElement, true);
// Show alert and ho back.
const message = this.translate.instant('core.login.emailconfirmsent', { $a: params.email });
@@ -349,7 +349,7 @@ export class CoreLoginEmailSignupPage {
this.wsProvider.callAjax('core_auth_is_minor', params, {siteUrl: this.siteUrl}).then((result) => {
- this.domUtils.triggerFormSubmittedEvent(this.ageFormElement.nativeElement, true);
+ this.domUtils.triggerFormSubmittedEvent(this.ageFormElement, true);
if (!result.status) {
if (this.countryControl.value) {
diff --git a/src/core/login/pages/forgotten-password/forgotten-password.ts b/src/core/login/pages/forgotten-password/forgotten-password.ts
index 9b975e958..212840455 100644
--- a/src/core/login/pages/forgotten-password/forgotten-password.ts
+++ b/src/core/login/pages/forgotten-password/forgotten-password.ts
@@ -82,7 +82,7 @@ export class CoreLoginForgottenPasswordPage {
this.domUtils.showErrorModal(response.notice);
} else {
// Success.
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
this.domUtils.showAlert(this.translate.instant('core.success'), response.notice);
this.navCtrl.pop();
diff --git a/src/core/login/pages/reconnect/reconnect.ts b/src/core/login/pages/reconnect/reconnect.ts
index d8dea0a67..f36a21975 100644
--- a/src/core/login/pages/reconnect/reconnect.ts
+++ b/src/core/login/pages/reconnect/reconnect.ts
@@ -181,7 +181,7 @@ export class CoreLoginReconnectPage {
this.sitesProvider.getUserToken(siteUrl, username, password).then((data) => {
return this.sitesProvider.updateSiteToken(this.infoSiteUrl, username, data.token, data.privateToken).then(() => {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
// Update site info too because functions might have changed (e.g. unisntall local_mobile).
return this.sitesProvider.updateSiteInfoByUrl(this.infoSiteUrl, username).then(() => {
diff --git a/src/core/login/pages/site/site.ts b/src/core/login/pages/site/site.ts
index 92193fd92..9e44cbd4f 100644
--- a/src/core/login/pages/site/site.ts
+++ b/src/core/login/pages/site/site.ts
@@ -107,7 +107,7 @@ export class CoreLoginSitePage {
this.sitesProvider.getUserToken(siteData.url, siteData.username, siteData.password).then((data) => {
return this.sitesProvider.newSite(data.siteUrl, data.token, data.privateToken).then(() => {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
return this.loginHelper.goToSiteInitialPage();
}, (error) => {
@@ -189,7 +189,7 @@ export class CoreLoginSitePage {
protected async login(response: CoreSiteCheckResponse): Promise {
return this.sitesProvider.checkRequiredMinimumVersion(response.config).then(() => {
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
if (response.warning) {
this.domUtils.showErrorModal(response.warning, true, 4000);
diff --git a/src/core/search/components/search-box/search-box.ts b/src/core/search/components/search-box/search-box.ts
index f41742eab..8a3116c14 100644
--- a/src/core/search/components/search-box/search-box.ts
+++ b/src/core/search/components/search-box/search-box.ts
@@ -98,7 +98,7 @@ export class CoreSearchBoxComponent implements OnInit {
this.saveSearchToHistory(this.searchText);
}
- this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
+ this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
this.searched = this.searchText;
this.onSubmit.emit(this.searchText);
diff --git a/src/providers/utils/dom.ts b/src/providers/utils/dom.ts
index 89e3d9fbf..35055cbb1 100644
--- a/src/providers/utils/dom.ts
+++ b/src/providers/utils/dom.ts
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import { Injectable, SimpleChange } from '@angular/core';
+import { Injectable, SimpleChange, ElementRef } from '@angular/core';
import {
LoadingController, Loading, ToastController, Toast, AlertController, Alert, Platform, Content, PopoverController,
ModalController,
@@ -1635,10 +1635,14 @@ export class CoreDomUtilsProvider {
* @param form Form element.
* @param siteId The site affected. If not provided, no site affected.
*/
- triggerFormCancelledEvent(form: HTMLElement, siteId?: string): void {
+ triggerFormCancelledEvent(formRef: ElementRef, siteId?: string): void {
+ if (!formRef) {
+ return;
+ }
+
this.eventsProvider.trigger(CoreEventsProvider.FORM_ACTION, {
action: 'cancel',
- form: form,
+ form: formRef.nativeElement,
}, siteId);
}
@@ -1649,10 +1653,14 @@ export class CoreDomUtilsProvider {
* @param online Whether the action was done in offline or not.
* @param siteId The site affected. If not provided, no site affected.
*/
- triggerFormSubmittedEvent(form: HTMLElement, online?: boolean, siteId?: string): void {
+ triggerFormSubmittedEvent(formRef: ElementRef, online?: boolean, siteId?: string): void {
+ if (!formRef) {
+ return;
+ }
+
this.eventsProvider.trigger(CoreEventsProvider.FORM_ACTION, {
action: 'submit',
- form: form,
+ form: formRef.nativeElement,
online: !!online,
}, siteId);
}