mirror of
https://github.com/astaxie/beego.git
synced 2024-10-31 23:50:54 +00:00
Merge pull request #3621 from guanle/guanle-patch-1
Update templatefunc.go for default value tag
This commit is contained in:
commit
6123c72752
@ -300,7 +300,12 @@ func parseFormToStruct(form url.Values, objT reflect.Type, objV reflect.Value) e
|
||||
formValues := form[tag]
|
||||
var value string
|
||||
if len(formValues) == 0 {
|
||||
continue
|
||||
defaultValue := fieldT.Tag.Get("default")
|
||||
if defaultValue != "" {
|
||||
value = defaultValue
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if len(formValues) == 1 {
|
||||
value = formValues[0]
|
||||
|
Loading…
Reference in New Issue
Block a user