if statement - How to make if loop in grails? -
i'm beginner in grails, please help. have in gsp
<div class="right66"> <g:select class="time_pick" name="pick_day" placeholder="" from="${['dani', 'sati', 'minute']}" valuemessageprefix="book.category"/> </div>
in translation: dani = days, sati = hours, minute = minutes. need save data in minutes user can choose if input in minutes, hours, or days. have if loop. know how if loop works don't know how write in grails. thinking this:
n=1 if(params.type=dani){ n= 3600 }else if(params.type=sati) { n=60 } def minute=params.minute*n
but how call chosen input "dani"? can't write params.type=dani. if loop go in controller in case?
if need convert input minutes, should in controller or service. if
here same in java or groovy. inputs view in params
object in controller same name input's id.
def minutes = params.input if (params.pick_day in ['sati', 'dani']) { minutes *= 60 if (params.pick_day == 'dani') { minutes *= 24 } }
Comments
Post a Comment