Collect first/last name on the course enroll form
deploy / deploy (push) Successful in 4s

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-23 19:47:33 -04:00
parent 143ddfda92
commit dbeb634110
+11 -1
View File
@@ -1,6 +1,12 @@
{{ $id := .id }} {{ $id := .id }}
{{ $page := .page }} {{ $page := .page }}
<form id="enroll-form-{{ $id }}" class="enroll-form"> <form id="enroll-form-{{ $id }}" class="enroll-form">
<label for="first-name-{{ $id }}">First name</label>
<input type="text" id="first-name-{{ $id }}" name="first_name" required autocomplete="given-name">
<label for="last-name-{{ $id }}">Last name (optional)</label>
<input type="text" id="last-name-{{ $id }}" name="last_name" autocomplete="family-name">
<label for="email-{{ $id }}">Email</label> <label for="email-{{ $id }}">Email</label>
<input type="email" id="email-{{ $id }}" name="email" required autocomplete="email" placeholder="you@example.com"> <input type="email" id="email-{{ $id }}" name="email" required autocomplete="email" placeholder="you@example.com">
@@ -28,7 +34,11 @@
fetch("{{ $page.Site.Params.eec_base_url }}/courses/" + slug + "/enroll", { fetch("{{ $page.Site.Params.eec_base_url }}/courses/" + slug + "/enroll", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ email: form.email.value }) body: JSON.stringify({
email: form.email.value,
first_name: form.first_name.value,
last_name: form.last_name.value
})
}).then(function (res) { }).then(function (res) {
if (res.ok) { if (res.ok) {
form.reset(); form.reset();