#javascript #django #django-forms #django-authentication #sweetalert
Вопрос:
Я пытаюсь войти в свое приложение Django, но, как и когда я нажимаю «Отправить», форма не отправляется. Я считаю, что идентификатор JavaScript KTSigninGeneral
sweetalert препятствует его отправке, потому что я могу войти в систему без идентификатора sweetalert. Я хочу иметь возможность войти в систему с помощью плагина sweetalert. Вот код
Кнопка Отправить
lt;!--begin::Actions--gt; lt;div class="text-center"gt; lt;!--begin::Submit button--gt; lt;button type="submit" id="kt_sign_in_submit" class="btn btn-lg btn-primary w-100 mb-5"gt; lt;span class="indicator-label"gt;Continuelt;/spangt; lt;span class="indicator-progress"gt;Please wait... lt;span class="spinner-border spinner-border-sm align-middle ms-2"gt;lt;/spangt;lt;/spangt; lt;/buttongt; lt;!--end::Submit button--gt; lt;/divgt; lt;!--end::Actions--gt;
язык JavaScript
"use strict"; var KTSigninGeneral = function () { var t, e, i; return { init: function () { t = document.querySelector("#kt_sign_in_form"), e = document.querySelector("#kt_sign_in_submit"), i = FormValidation.formValidation(t, { fields: { email: { validators: { notEmpty: { message: "Email address is required" }, emailAddress: { message: "The value is not a valid email address" } } }, password: { validators: { notEmpty: { message: "The password is required" } } } }, plugins: { trigger: new FormValidation.plugins.Trigger, bootstrap: new FormValidation.plugins.Bootstrap5({ rowSelector: ".fv-row" }) } }), e.addEventListener("click", (function (n) { n.preventDefault(), i.validate().then((function (i) { "Valid" == i ? (e.setAttribute("data-kt-indicator", "on"), e.disabled = !0, setTimeout((function () { e.removeAttribute("data-kt-indicator"), e.disabled = !1, Swal.fire({ text: "You have successfully logged in!", icon: "success", buttonsStyling: !1, confirmButtonText: "Ok, got it!", customClass: { confirmButton: "btn btn-primary" } }).then((function (e) { e.isConfirmed amp;amp; (t.querySelector('[name="email"]').value = "", t.querySelector('[name="password"]').value = "") })) }), 2e3)) : Swal.fire({ text: "Sorry, looks like there are some errors detected, please try again.", icon: "error", buttonsStyling: !1, confirmButtonText: "Ok, got it!", customClass: { confirmButton: "btn btn-primary" } }) })) })) } } }(); KTUtil.onDOMContentLoaded((function () { KTSigninGeneral.init() }));