[英]Grails validators don't work
I'm hoping this just needs a new pair of eyes casting over it. 我希望这只需要一双新的眼睛。
I have a school class 我有一堂课
class School {
String name
static constraints = {
name(maxLength:50,blank:false)
}
static hasMany = [pupils:Reviewer]
String toString() {
return name
}
}
I have a School controller 我有一个学校控制器
class SchoolController {
def scaffold = School
}
When I run the app and put a very long ( much longer than 50 than 50 char ) or even a blank name into my add school form, the constraints don't seem to be obeyed. 当我运行应用程序并在我的添加学校表单中放置一个非常长(超过50个字符50)甚至一个空白名称时,似乎没有遵守约束。
What am I missing? 我错过了什么?
Dave 戴夫
According to the Grails Validation Reference maxLength is deprecated.. 根据Grails验证参考, maxLength已被弃用..
Have you tried using maxSize instead? 您是否尝试过使用maxSize?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.