validation - Validate empty select in controller? -
i have view has select list on shown below:
<g:select name="field_time" from="${["00", "01", "02", "03", "04", "05", "06", "07", "08", "09"] + (10..23)}" value="${timehr}" noselection="['':'-time-']"/>
now when user not select list , "noselection" value set expect param store "" data on forms submit. went on trying validate if data in select field empty on controller couldn’t on domain data never hits domain, had code below:
if(params.field_time.size() == 0 || params.field_time == "" || params.field_time == null){ println("inside validate select function") }
i check of params see being returned in object , data below:
field_time:[, ]
so when run code expecting print message screen doesn’t :s
i presume checking wrong things in if statement , maybe thinking need split params returned object first not sure, appreciate on this.
thanks in advance
Comments
Post a Comment