-1

I have this select input in my gsp:

<g:select id="whitelistId" name="whitelistId" noSelection="${['nx':'-Select whitelist-']}" from="${Whitelist.list()}" optionValue="description" optionKey="id" />

Even if I change to another item in the dropdown, "nx" value is being sent as params value. If I omit noSelection attribute, it works as expected.

This is the generated html code when "My whitelist" item is selected:

<select id="whitelistId" name="whitelistId">
  <option value="nx">-Select whitelist-</option>
  <option value="6118854">My whitelist</option>
</select>

I'm using Grails 2.2.0

Any tips?

Thanks

saw303
  • 8,051
  • 7
  • 50
  • 90
Nedo
  • 627
  • 1
  • 10
  • 20

1 Answers1

1

ref-doc states:

Typically this will be blank - but you can also use 'null' in the case that you're passing the ID of an object

so, it's better to use

noSelection="${['':'-Select whitelist-']}"

or

noSelection="${[null:'-Select whitelist-']}"

injecteer
  • 20,038
  • 4
  • 45
  • 89