Search code examples
jquerygrailsdrop-down-menujquery-chosen

jquery chosen, empty String as option


I´m using chosen.js for Dropdowns in a form on a grails-environment. I want the users to be able to select an empty option, but somehow it is ignored. There must be a possibility to do this? Because the workaround to set an option like "select-none" and later in data-bindig make a if condition if select-none value= "" would be unpretty.

to show my problem :

for example this select :

<g:select id="foo" data-placeholder="bar"  class="foo chzn-select" style="width: 245px;" tabindex="4" 
                    from="${['M', ' ', 'F']}" value="foo" name="titel"/>

would return :

enter image description here

Sure this is a nice feature of chosen, but i guess my case is a common case and maybe someone of you already has a solution to override this behaviour

thanks in advance


Solution

  • <g:select name="foo" from="${foos}" noSelection="[' ':' ']"  />