17 lines
718 B
HTML
17 lines
718 B
HTML
{{- $type := .Parent.Get "type" -}}
|
|
{{- $name := .Parent.Get "name" -}}
|
|
{{- $value := .Get "value" -}}
|
|
{{- $label := .Get "label" -}}
|
|
{{- $selected := eq (.Get "selected") "true" -}}
|
|
{{- $required := or (and (eq $type "radio") (eq (.Parent.Get "required") "true")) (and (eq $type "checkbox") (eq (.Get "required") "true")) -}}
|
|
{{- if eq $type "select" -}}
|
|
<option value="{{ $value }}"{{ if $selected }} selected{{ end }}>{{ $label }}</option>
|
|
{{- else -}}
|
|
<li>
|
|
<input id="{{ $name }}-{{ $value }}" type="{{ $type }}" name="{{ $name }}" value="{{ $value }}"{{ if $required }} required{{ end }}{{ if $selected }} checked{{ end }}>
|
|
<label for="{{ $name }}-{{ $value }}">
|
|
{{ $label }}
|
|
</label>
|
|
</li>
|
|
{{- end -}}
|