Grail command objects instance validation? -
let's have command-object containing 7 fields(string monday, string tuesday, ..) , need validate check if @ to the lowest degree 1 of them exists.
because of working grails 1.3.7 tried utilize instance validation extended-validation-plugin(not rich-domain) couldn't create work. basically, not recognise non-field validator within of static constraints block.
static constraints = { availabilityselected(validator: { ... }) ...
and get:
exception message: no such property: availabilityselected
is there other smart way it? not want add together validator every single field in command object.
thanks
you can access object beingness validated via 2 / 3 parameter form of custom validator.
myfield(validator: { val, obj, errors -> if( obj.blah.empty && obj.blah.empty ) { errors.reject( ... ) } )
http://grails.org/doc/1.3.7/ref/constraints/validator.html
validation grails command-objects
No comments:
Post a Comment