Skip to content

Commit

Permalink
fix: fixing form submission
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoM committed Jul 28, 2023
1 parent 6ec67be commit e49bb5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
7 changes: 4 additions & 3 deletions public/creator.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<!-- Add the QR code generator library -->
<script src="https://cdn.jsdelivr.net/npm/qrcode-generator/qrcode.js"></script>

<script src="/scripts/creator.js?v=1.0.1"></script>
<script src="/scripts/creator.js?v=1.0.2"></script>
</head>

<body class="bg-[#FFFFFF] text-[#3B3B3B]">
Expand All @@ -35,7 +35,7 @@ <h1 class="text-[#8358f9] text-4xl font-bold mb-4">Bondscape Event Creator</h1>
<span class="font-bold">Note</span>: This tool can only be used by people possessing an admin key.
</p>

<form id="eventCreationForm" action="">
<form id="eventCreationForm" onsubmit="return false;">
<div class="mb-4">
<label for="name" class="block font-bold mb-2">Name <span class="text-[#8358f9]">*</span></label>
<input type="text" id="name" name="name" autocomplete="off"
Expand Down Expand Up @@ -103,7 +103,8 @@ <h1 class="text-[#8358f9] text-4xl font-bold mb-4">Bondscape Event Creator</h1>
required>
</div>

<button type="submit" class="w-full bg-[#8358f9] hover:bg-[#5C3EAE] text-white font-bold py-2 px-4 rounded">
<button type="submit" onclick="submitForm()"
class="w-full bg-[#8358f9] hover:bg-[#5C3EAE] text-white font-bold py-2 px-4 rounded">
Create Event
</button>
</form>
Expand Down
14 changes: 5 additions & 9 deletions public/scripts/creator.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,8 @@ async function handleFormSubmission(event) {
// --- Page setup
// --------------------------------------------------------------------------------------------------------------------

window.addEventListener("DOMContentLoaded", function () {
document.getElementById("eventCreationForm").addEventListener("submit", function (event) {
event.preventDefault();

showLoadingIndicator();

setTimeout(handleFormSubmission, 2000);
});
});
function submitForm(event) {
event.preventDefault();
showLoadingIndicator();
setTimeout(handleFormSubmission, 2000);
}

0 comments on commit e49bb5b

Please sign in to comment.