Reputation: 243
I'm very new to grails web application! Here is my domain class
package imocha.project
class Feedback {
String name
String email
String type
String remark
static constraints = {
name(blank:true)
email(blank:true)
type(blank:false)
remark(blank:false)
}
}
In my case, I just want to set only the type and remark can't be blank! But at the end, it set all for me.
Upvotes: 0
Views: 93
Reputation: 24776
The reason for this is the default behavior for properties is nullable: false
in a Grails project. Alter your constraints as follows:
package imocha.project
class Feedback {
String name
String email
String type
String remark
static constraints = {
name(nullable:true, blank:true)
email(nullable:true, blank:true)
type(blank:false)
remark(blank:false)
}
}
Upvotes: 1