开发者

How to display field based on another one

开发者 https://www.devze.com 2023-01-17 17:34 出处:网络
I have something like this: Class person { string name string status boolean working boolean vacation } static constraints = {

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>
0

精彩评论

暂无评论...
验证码 换一张
取 消