Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
admpub committed May 26, 2021
1 parent 5ea7a0e commit c0163bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions fields/number.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ func NumberFieldFromInstance(val reflect.Value, t reflect.Type, fieldNo int, nam
if v := common.TagVal(t, fieldNo, "form_max"); v != "" {
ret.SetParam("max", v)
}
if v := common.TagVal(t, fieldNo, "form_step"); v != "" {
ret.SetParam("step", v)
}
ret.SetValue(defaultValue(val, t, fieldNo, useFieldValue))
return ret
}
Expand Down
9 changes: 6 additions & 3 deletions forms.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,11 @@ func (form *Form) unWindStructure(m interface{}, baseName string) ([]interface{}
label := common.TagVal(t, i, "form_label")
if len(label) == 0 {
label = strings.Title(t.Field(i).Name)
} else if label != `-` {
label = form.labelFn(label)
} else {
label = ``
}
label = form.labelFn(label)
f.SetLabel(label)

params := common.TagVal(t, i, "form_params")
Expand All @@ -503,8 +506,8 @@ func (form *Form) unWindStructure(m interface{}, baseName string) ([]interface{}
if len(valid) > 0 {
form.validTagFn(valid, f)
}
fieldsetLabel := common.TagVal(t, i, "form_fieldset")
fieldsort := common.TagVal(t, i, "form_sort")
fieldsetLabel := common.TagVal(t, i, "form_fieldset") // label;name or name
fieldsort := common.TagVal(t, i, "form_sort") // 1 ( or other number ) or "last"
if len(fieldsetLabel) > 0 {
fieldsets := strings.SplitN(fieldsetLabel, ";", 2)
var fieldsetName string
Expand Down

0 comments on commit c0163bc

Please sign in to comment.