How to display field based on another one
I have something like this:
Class person {
string name
string status
boolean working
boolean vacation
}
static constraints = {
name()
status(inList: ["Active","开发者_开发技巧Inactive"])
}
What I need is to show the working and vacation fields in the create and edit views, only if Active is selected in status. I searched and read alot but can't find a way, maybe I'm missing something since I'm new to grails. Any help is appreciated. Thank you
This can not easily be done with Dynamic scaffolding. You will need to edit the generated views to add the logic in. See the GSP tag refference for if at http://grails.org/doc/latest/ref/Tags/if.html In your case something like
<g:if test="$person.active ==true">
Insert GSP code to edit data here.
</g:if>
精彩评论