I have a list of, let's say, persons. Every person has a field that is "friend", that could be "yes" or "no". Their "friendship" status is presented in a column in the list:
<g:if test="${person.friend.status=='no' }">
<td><g:textField name="status" value="${person.friend.status}" readonly="readonly" style="width:60px;border:0px; background:transparent;color:black"/></td>
<td style="width:20px">
<g:actionSubmitImage action="acceptFriend" value="aceptar" src="${resource(dir: 'images', file: '/skin/tick_16.png')}" style="width:5px;height:8px;"/>
</td>
<td>
<g:actionSubmitImage action="refuseFriend" value="aceptar" src="${resource(dir: 'images', file: '/skin/wrong_16.png')}" style="width:5px;height:8px;"/>
</td>
</g:if>
As you can see, when the friend status is "no", two buttons are presented, one to say "that person is my friend" and another one to say "this person is not my friend". My question is:
When i click on the image that says "this person is my friend", I call the action "acceptFriend". But, how to access to the indivivual person instance, to change his status to "yes", and persist in the database? I think it may be with the "params" variable, but how to store it in the params to be accessed in the Controller?
Thank you!