This commit is contained in:
caandt 2024-10-11 20:54:58 -05:00
parent 95e1b9d714
commit 01cad4a53e
2 changed files with 15 additions and 1 deletions

View file

@ -4,7 +4,7 @@ title: message
<div class="container"> <div class="container">
<div class="panel f"> <div class="panel f">
<h2>contact</h2> <h2>contact</h2>
<form method="post" action="/_/message"> <form method="post" action="/_/message" id="form">
<label><input type="text" name="name" value="" required>name</label> <label><input type="text" name="name" value="" required>name</label>
<label><input type="text" name="email" value="">email / other contact info</label> <label><input type="text" name="email" value="">email / other contact info</label>
<br> <br>
@ -12,5 +12,16 @@ title: message
<br> <br>
<input type="submit" value="submit"> <input type="submit" value="submit">
</form> </form>
<script type="module">
import { popup } from '/static/util.js'
const form = document.getElementById('form')
form.onsubmit = e => {
e.preventDefault();
fetch(e.target.action, {method: 'POST', body: new FormData(e.target)}).then(() => {
popup('submitted!');
form.reset();
});
}
</script>
</div> </div>
</div> </div>

View file

@ -43,6 +43,9 @@ input, textarea {
border: 1px solid var(--fg); border: 1px solid var(--fg);
margin: 5px; margin: 5px;
} }
input[type=submit] {
cursor: pointer;
}
table, th, td { table, th, td {
border: 1px dashed var(--fg); border: 1px dashed var(--fg);
border-collapse: collapse; border-collapse: collapse;