shelves/backend/templates/tmpls/form.tmpl.html
2024-11-14 17:39:31 -05:00

31 lines
548 B
HTML

{{define "attrs"}}
placeholder="{{.Placeholder}}"
aria-invalid="{{.Valid}}"
{{if .Error}}
aria-describedby="{{.Name}}-error"
{{end}}
{{end}}
<form action="{{.Action}}" method="{{.Method}}">
{{range .Fields}}
<label>
{{.Label}}
{{if eq .Type "textarea"}}
<textarea
{{template "attrs" .}}
>{{.Value}}</textarea>
{{else}}
<input
type="{{.Type}}"
value="{{.Value}}"
{{template "attrs" .}}
>
{{end}}
</label>
{{if .Error}}
<small id="{{.Name}}-error">{{.Error}}</small>
{{end}}
{{end}}
</form>