{{ define "add-button" }} <button type="button" hx-post="/add-participant/" hx-target="this" hx-swap="outerHTML"> Neuer Teilnehmer </button> {{ end }} {{ define "new" }} <span>{{ . }}</span> {{ template "add-button" . }} {{ end }} {{ define "content" }} <form> <div id="instructor"> <label for="instructor-first-input">Unterweiser Vorname</label> <input type="text" name="instructor-first" id="instructor-first-input" /> <label for="instructor-last-input">Unterweiser Nachname</label> <input type="text" name="instructor-last" id="instructor-last-input" /> </div> <div id="location"> <label for="location-input">Ort</label> <input type="text" name="location" id="location-input" /> </div> <div id="state"> <label for="state-input">Stand vom</label> <input type="date" name="state" id="state-input" /> </div> {{ template "add-button" . }} <button type="submit" hx-post="/submit-form/" hx-target="#content" hx-swap="innerHTML"> OK </button> </form> {{ end }}