Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Grails, how to invoke a controller action from a g:select

I'm using a g:select (actually, a g:currencySelect) in my view.

I want a controller action to fire as soon as the user changes the value in the resulting select box.

How can I do this?

like image 939
Dick Chesterwood Avatar asked Nov 09 '09 17:11

Dick Chesterwood


Video Answer


1 Answers

I think I'm answering my own question here, but do let me know if there's a better way of doing this:

Use the onchange javascript function in the select tag:

<g:form controller="changeCurrency" action="changeCurrency">
    <g:select onchange="submit()"/>
</g:form>
like image 93
Dick Chesterwood Avatar answered Nov 15 '22 12:11

Dick Chesterwood