Monday, 15 July 2013

spring validator - How to propagate from parent command to child command in grails -



spring validator - How to propagate from parent command to child command in grails -

i have following...

static constraints = { items nullable: true , validator: { val, obj -> if(val){ for(int = 0; < val.size(); i++){ bundledefinitioncommand bdc = val[i] def errors = [] val.each{ if(!bdc.validate()){ obj.errors.addallerrors(bdc.errors.getallerrors()) } } string test = "test" } } } }

but when run validator get...

no signature of method: grails.validation.validationerrors.addallerrors() applicable argument types: (java.util.collections$unmodifiablelist) values:....

i tried...

obj.errors.addallerrors(bdc.errors)

i believe should alter validator signature to

validator: { val, obj, errors ->

and utilize 3rd parameter so:

errors.addallerrors(bdc.errors.getallerrors())

also, scratch temp errors array , string test.

items nullable: true , validator: { val, obj, errors -> if(val){ for(int = 0; < val.size(); i++){ bundledefinitioncommand bdc = val[i] val.each{ if(!bdc.validate()){ errors.addallerrors(bdc.errors.getallerrors()) } } } } }

grails spring-validator

No comments:

Post a Comment