0% found this document useful (0 votes)
15 views1 page

Form Submission with Authentication Check

Uploaded by

nikk7498
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views1 page

Form Submission with Authentication Check

Uploaded by

nikk7498
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

<script>

[Link]('DOMContentLoaded', function () {
// Listen for the submit button click
[Link]('scan-btn').addEventListener('click',
function (event) {
[Link](); // Prevent page reload

// Check authentication status at the time of button click


let isAuthenticated = checkAuthenticationStatus();

if (!isAuthenticated) {
alert("Please log in to Submit."); // Show alert if not
authenticated
} else {
submitForm(); // Proceed with form submission if
authenticated
}
});

function submitForm() {
// Show loader before submitting the form
var fileType = [Link]('document-
type').value;
[Link]('fileType').value = fileType;
showLoader(); // Show loading indicator
[Link]('capture-form').submit(); // Submit
the form
}

function showLoader() {
[Link]("loading").[Link] = "block";
}

function hideLoader() {
[Link]("loading").[Link] = "none";
}

// Hide loader once everything is loaded


[Link]('load', function () {
hideLoader();
});

You might also like