【发布时间】:2014-01-09 11:38:34
【问题描述】:
public class Service {
String reviewChanges
String comment
static constraints = {
reviewChanges (inList:['NO','YES'])
comment validator: { val, obj ->
if(reviewChanges=='YES') {
(nullable:false, blank:false, minSize:1, maxSize:500)
} else {
(nullable:true, blank:true, minSize:1, maxSize:500)
}
}
}
}
以上评论验证器对我不起作用。 我想如果 reviewChanges 字段选择 YES 那么 Comment 字段必须是 Mandatory 字段否则 Comment filed Non-Mandatory
【问题讨论】:
标签: grails grails-orm grails-2.0 grails-domain-class