Pergunta

I am relatively new to Grails (using v2.3.5) and generating views for my Person domain class:

class Person {

String title
String firstName
String lastName

static constraints = {
    title inList: ["Mr", "Ms", "Dr"], blank: false
    firstName maxSize: 100, blank: false
    lastName maxSize: 100, blank: false
}                                      

}

The scaffolding generates the following textfield:

<g:textField name="lastName" maxlength="100" required="" value="${personInstance?.lastName}"/>

I seem to remember in previous grails versions, the domain constraints would be dynamic rather than hardcoded, e.g

<g:textField name="lastName" maxlength="personInstance?.constraints?.lastName?.maxSize" required="" value="${personInstance?.lastName}"/>

Is there a reason why this changed? It does not seem like a better practice to me.

Thanks a lot in advance!

Foi útil?

Solução

you can follow your very own best practice by installing the grails templates http://www.grails.org/doc/2.2.x/ref/Command%20Line/install-templates.html into your app and modify them in a way you need it

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top