Sagarmichael
Sagarmichael

Reputation: 1624

grails many buttons on one form

I have a form where you can select something from a selector and click and image this then fires to a controller. The problem is currently the images are submit buttons which i can send params with so i dont know which image has been clicked. my current code it as follows:

   <g:form controller="profile" action='postFromAlbum'>
        <g:select name="child" from="${names}" value="" noSelection="['':'All Children']"/>   <br

               <g:each in="${pictures}">

                   <g:submitButton name="submit" class="image3" type="image" src="${it.urlThumb}" alt="no Picture"></g:submitButton>

               </g:each>
        </g:form>

does anyone know a better way or know of a way to get around this?

Upvotes: 1

Views: 91

Answers (1)

Victor Sergienko
Victor Sergienko

Reputation: 13495

One way is to create an analog of actionSubmit that will support params, like in this question.

Another hacky way is to set an invisible text/radio field and set its value in button's onclick.

Upvotes: 1

Related Questions