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?
The problem was caused by me forgetting to wrap the select tags in a form tag. I wrapped them in a form submit tag and I can now access the information by using the select tags id and clicking on an actionSubmit button.