Commit 91886a45 authored by pylemon's avatar pylemon Committed by astaxie

bugfix: if a form field type is bool, valid Required should always return true…

bugfix: if a form field type is bool, valid Required should always return true instead of return its value.
parent a7e60c93
...@@ -64,8 +64,8 @@ func (r Required) IsSatisfied(obj interface{}) bool { ...@@ -64,8 +64,8 @@ func (r Required) IsSatisfied(obj interface{}) bool {
if str, ok := obj.(string); ok { if str, ok := obj.(string); ok {
return len(str) > 0 return len(str) > 0
} }
if b, ok := obj.(bool); ok { if _, ok := obj.(bool); ok {
return b return true
} }
if i, ok := obj.(int); ok { if i, ok := obj.(int); ok {
return i != 0 return i != 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment