Verified Commit 24db3fd3 authored by Nicolai Van der Storm's avatar Nicolai Van der Storm
Browse files

added contact form

parent be4e6f85
Pipeline #601211859 passed with stages
in 2 minutes and 25 seconds
......@@ -45,6 +45,7 @@ topText = [
"Made with &#10084; by <a href=\"\">Nicolai Van der Storm</a>",
bottomText = [
"<a href=\"/contact\">Contact</a>",
"<a href=\"/privacy\">Privacy Policy</a>",
"Powered by <a href=\"\">Hugo</a>",
title: ""
date: 2022-07-28T17:15:02+02:00
draft: false
<section class="get-in-touch">
<h1 class="title">Get in touch</h1>
<form action="#" method="post" class="contact-form row">
<div class="form-field col x-50">
<input name="Name" id="name" class="input-text js-input" type="text" placeholder="" required>
<label class="label" for="name">Name</label>
<div class="form-field col x-50">
<input name="Email" id="email" class="input-text js-input" type="email" placeholder="" required>
<label class="label" for="email">E-mail</label>
<div class="form-field col x-100">
<input name="Message" id="message" class="input-text js-input" type="text" placeholder="" required>
<label class="label" for="message">Message</label>
<div class="form-field col x-100 align-center">
<input class="submit-btn" type="submit" value="Submit">
<script !src="">
// 6eZQtIgL05fk1GDUklmd6CNDRndEm3cajw89YYhf
const form = document.querySelector('.contact-form');
const button = document.querySelector('.submit-btn');
form.addEventListener('submit', (e) => {
//disable the button
button.setAttribute('disabled', 'disabled');
button.value = 'Sending...';
const values = new FormData(
const payload = Object.fromEntries(values.entries());
fetch('', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'xc-token': '6eZQtIgL05fk1GDUklmd6CNDRndEm3cajw89YYhf'
body: JSON.stringify(payload)
.then(res => res.json())
.then(data => {
//set button text to message sent and color to green
button.value = 'Message sent';
// set button cursor to block = 'not-allowed';
Subproject commit 2045cc8a57e4e15c62a6cd1351ec6aa13e1cbc3e
Subproject commit 7a8879612e5d523502f477263569ed6a4a2b4877
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment