add form validation

This commit is contained in:
Philipp 2021-08-29 18:22:08 +02:00
parent 82f11b254b
commit 3f2cbcea33
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 276B613AF9DBE9C3
8 changed files with 131 additions and 18 deletions

View file

@ -20,8 +20,10 @@
<div class="text-right">
<form action="/threads/{{.Thread.ID}}/{{.Post.ID}}" method="POST">
{{.CSRF}}
<textarea name="content" class="form-control border-0 border-bottom-1 p-3"
placeholder="What are your thoughts?" rows="4"></textarea>
<textarea name="content" class="form-control border-0 border-bottom-1 p-3 {{with .Form.Errors.Content}}is-invalid{{end}}"
placeholder="What are your thoughts?" rows="4">
{{- with .Form.Content}}{{.}}{{end -}}
</textarea>
<div class="border-top p-1">
<button class="btn btn-primary btn-sm">Comment</button>
</div>