mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 09:44:21 +00:00 
			
		
		
		
	Add validations.required check to dropdown field (#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:  Post request form:  Result: 
This commit is contained in:
		@@ -4,7 +4,9 @@
 | 
				
			|||||||
	<div class="ui fluid selection dropdown {{if .item.Attributes.multiple}}multiple clearable{{end}}">
 | 
						<div class="ui fluid selection dropdown {{if .item.Attributes.multiple}}multiple clearable{{end}}">
 | 
				
			||||||
		<input type="hidden" name="form-field-{{.item.ID}}" value="0">
 | 
							<input type="hidden" name="form-field-{{.item.ID}}" value="0">
 | 
				
			||||||
		{{svg "octicon-triangle-down" 14 "dropdown icon"}}
 | 
							{{svg "octicon-triangle-down" 14 "dropdown icon"}}
 | 
				
			||||||
 | 
							{{if not .item.Validations.required}}
 | 
				
			||||||
		{{svg "octicon-x" 14 "remove icon"}}
 | 
							{{svg "octicon-x" 14 "remove icon"}}
 | 
				
			||||||
 | 
							{{end}}
 | 
				
			||||||
		<div class="default text"></div>
 | 
							<div class="default text"></div>
 | 
				
			||||||
		<div class="menu">
 | 
							<div class="menu">
 | 
				
			||||||
			{{range $i, $opt := .item.Attributes.options}}
 | 
								{{range $i, $opt := .item.Attributes.options}}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user