'Getting the value from a Select tag (Grails)
I'm having a problem getting the select tag to work for me in Grails. Basically, I am trying to get a value from the select field and use it to sort a list being displayed on the gsp. The select tag looks like this:
<g:select from="['Ascending','Descending']" name="selectTest" id="selectTest" />
I am trying to use g:links to pass the information on. I was hoping I could do something similar to
<g:link action="sort" id="pid" params="[direction:${selectTest.value}]">Sort</g:link>
However, this does not work as the value is always passed as null. I can pass the data I want using a form and an actionSubmit, but I have 3 different tables columns that I need to be able to sort, so determining the desired column would be a pain. Also, there is no domain object being used, so using g:sortableColumn tags doesn't work either.
Is there a way to do this without having to use JavaScript and hiddenFields?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
