Skip to content

Commit de96503

Browse files
yp05327silverwind
authored andcommitted
Add validations.required check to dropdown field (go-gitea#24849)
If dropdown is marked as required, we should not provide the `remove` button. This will cause user may post empty value which seems like a bug. Definition: ![image](https://github.com/go-gitea/gitea/assets/18380374/cf48b478-244e-44e0-9a0e-7a0f02bc471a) Post request form: ![image](https://github.com/go-gitea/gitea/assets/18380374/31d6f823-835f-422a-879c-3b1e18950ac8) Result: ![image](https://github.com/go-gitea/gitea/assets/18380374/a9944fe9-24d0-4776-9eec-d31b70144eb4)
1 parent dbe537a commit de96503

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

templates/repo/issue/fields/dropdown.tmpl

+2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
<div class="ui fluid selection dropdown {{if .item.Attributes.multiple}}multiple clearable{{end}}">
55
<input type="hidden" name="form-field-{{.item.ID}}" value="0">
66
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
7+
{{if not .item.Validations.required}}
78
{{svg "octicon-x" 14 "remove icon"}}
9+
{{end}}
810
<div class="default text"></div>
911
<div class="menu">
1012
{{range $i, $opt := .item.Attributes.options}}

0 commit comments

Comments
 (0)