mirror of
https://github.com/astaxie/beego.git
synced 2024-11-26 05:51:29 +00:00
bugfix: if a form field type is bool, valid Required should always return true instead of return its value.
This commit is contained in:
parent
a7e60c93dc
commit
91886a4547
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user