1
0
mirror of https://github.com/astaxie/beego.git synced 2025-07-07 02:10:17 +00:00

Change meta to required, and refactor a bit to cover edge cases

This commit is contained in:
Joshua Santos
2016-06-30 10:32:53 -07:00
parent 84b6bef7d0
commit e0393b721c
2 changed files with 21 additions and 12 deletions

View File

@ -475,13 +475,10 @@ func parseFormTag(fieldT reflect.StructField) (label, name, fType string, id str
id = fieldT.Tag.Get("id")
class = fieldT.Tag.Get("class")
meta := strings.Split(fieldT.Tag.Get("meta"), ",")
required = false
switch len(meta) {
case 1:
if len(meta[0]) > 0 && meta[0] != "-" {
required = true
}
required_field := fieldT.Tag.Get("required")
if required_field != "-" && required_field != "" {
required, _ = strconv.ParseBool(required_field)
}
switch len(tags) {