I am new with grails. In my web application I have a hidden field
<g:hiddenField name="tags" id="tags" value=""></g:hiddenField>
value of this hidden field is setting on Submit.
<input type="submit" class="btn btn-default" onclick="setTag()" value="Ask Question"/>
and setTag method is defined as : function setTag() { $("#tags").val(selectedTagList); }
selectedTagList is a List of Ids.
when ever going to controller, if the value sending is 1,2,3 and in controller the value reach as [1,2,3, , ]
if it is a,b then the value reach as [a,b, , ] two extra parameters are receiving in controller. How can i avoid this extra parameters. ??
I've test your situation. It's a quite strange. There is empty value in controller via getting params variable. But, its normally with TextField. So, I think the first step, you should try to remove empty value in the list via this statement :
def clean = list.findAll { item -> item != ''}