gibsonsg
gibsonsg

Reputation: 35

Grails multiple action methods

In my view I call my action method like this:

<form class="my_form" action="${portletResponse.createActionURL()}" method='post'>
.....
<g:actionSubmit value="Save"/>

This takes me to my action method:

def actionView = {
//.... do stuff
}

However, I want to add more buttons in my view that call different action methods. One action might delete a row of data in one object. Another might create a row of data in another object. So my question is why does the createActionURL() call the actionView method in the controller and how can I implement multiple action methods for different types of actions?

Thanks!

Upvotes: 0

Views: 232

Answers (1)

Jeff Scott Brown
Jeff Scott Brown

Reputation: 27200

...and how can I implement multiple action methods for different types of actions?

You should use the <g:form... and <g:actionSubmit... tags. You can have as many submit buttons as you like in the form.

See http://docs.grails.org/3.2.4/ref/Tags/actionSubmit.html for more info.

Upvotes: 1

Related Questions