DaveH
DaveH

Reputation: 7335

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.

What am I missing?

Dave

Upvotes: 2

Views: 366

Answers (1)

j pimmel
j pimmel

Reputation: 11637

According to the Grails Validation Reference maxLength is deprecated..

Have you tried using maxSize instead?

Upvotes: 8

Related Questions