Noman_ibrahim
Noman_ibrahim

Reputation: 558

Difference between <g:actionSubmit> and <g:submittButton>

I am very new to grails. I have created a form. Where the action is ... action:"save". at the bottom of my form, I have used <g:actionSubmitt value="SAVE"/>. Notice here I have used value="SAVE" in capitalize and I got a 404. But I never faced this kind of problem in Spring. My query is, So I have to maintain the exact word that I have used in action: "save" and inside the value="save". And why on earth where I should use <g:submitButton>

Upvotes: 1

Views: 908

Answers (1)

rdmueller
rdmueller

Reputation: 11062

<g:actionSubmitt value="SAVE"/> lets you specify which action from the controller should be invoked. So if your form needs several different actions, like save and delete, you can use this tag. This also explains your 404 - you probably don't have a SAVE controller.

http://docs.grails.org/3.1.1/ref/Tags/actionSubmit.html

<g:submitButton> just adds a submit button with a name but without further functionality. So if you add several submit button, they will all invoke the same controller which you've specified in your <form> tag.

http://docs.grails.org/3.1.1/ref/Tags/submitButton.html

Upvotes: 2

Related Questions