Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"/app.js": "/app.js",
"/app.44b3c0de19a926b0aa07.hot-update.js": "/app.44b3c0de19a926b0aa07.hot-update.js"
}
7 changes: 6 additions & 1 deletion src/js/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from "axios";
import {disableForm,resetForm} from "./formHelper/formHelper";

// Set config defaults when creating the instance
const instance = axios.create({
Expand Down Expand Up @@ -33,7 +34,11 @@ const app = {
'Content-Type': 'application/json',
}
}).then(() => {
alert("Thank you, your form has been sent, your Slack invite will be emailed to you shortly!");
disableForm(inviteForm);
setTimeout(()=>{
alert("Thank you, your form has been sent, your Slack invite will be emailed to you shortly!");
resetForm(inviteForm);
},1500);
});
})
}
Expand Down
25 changes: 25 additions & 0 deletions src/js/formHelper/formHelper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export function disableForm(form) {
const btn = form.querySelector("button");
btn.disabled = true;
btn.style.opacity = "0.5";
btn.textContent = "Submitting...";

const inputs = Array.from(form.querySelectorAll(".form__input"));
inputs.map(input => {
input.disabled = true;
});
}

export function resetForm(form) {
const btn = form.querySelector("button");
btn.disabled = false;
btn.style.opacity = "1";
btn.textContent = "Submit";

const inputs = Array.from(form.querySelectorAll(".form__input"));
inputs.map(input => {
input.disabled = false;
input.value = "";
});

}