This is my view
<g:textArea name="review"/>
<g:actionSubmit action="addReview" params="${[gameId : "${game.id}", gameTitle : "${game.gameTitle}"] }" value="Add Review" class="ui blue labeled submit icon button">
<i class="icon edit"></i> Add Review
</g:actionSubmit>
In my addReview action when I do log.println(review)
It works but when I do log.println(gameTitle)
and log.println(gameId)
, it is null
.
I'm pretty sure ${game.gameTitle}
and ${game.gameTitle}
isn't null because it prints something when I put it on GSP.
https://grails.github.io/grails-doc/3.0.x/ref/Tags/actionSubmit.html
you can not add parameters in g:actionSubmit tag. try like this:
<g:textArea name="review"/>
<input name="gameId" value="${game.id}" type="hidden" />
<input name="gameTitle" value="${game.gameTitle}" type="hidden" />
<g:actionSubmit action="addReview" value="Add Review" class="ui blue labeled submit icon button">
<i class="icon edit"></i> Add Review
</g:actionSubmit>