How to create multiple submit buttons in gsp of groovy with grails?
I have three actions namely create, createMonthly, createQuarterly and i have only one gsp page in that i ne开发者_StackOverflowed to create three submit buttons that three buttons are data will be goto save action...
I created the buttons like this
<div class="buttons">
<span class="button"><g:submitButton name="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /></span>
<br>
<span class="button"><g:submitButton name="createMonthly" class="save" value="${message(code: 'default.button.createMonthly.label', default: 'Create Monthly')}" /></span>
<br>
<span class="button"><g:submitButton name="createQuarterly" class="save" value="${message(code: 'default.button.createQuarterly.label', default: 'Create Quarterly')}" /></span>
</div>
but its not working properly in the sense when i click any button it show create action only, how to call createMonthly and createQuarterly actions from this, plz help me.....
Use actionSubmit in your GSP.
For example:
<!--'Update' is action, label is 'Some update label'-->
<g:actionSubmit value="Some update label" action="Update" />
As Nicolas said. use actionSubmit. Your code should look like this.
<div class="buttons">
<span class="button"><g:actionSubmit action="create" class="save" value="${message(code: 'default.button.create.label', default: 'Create')}" /></span>
<br>
<span class="button"><g:actionSubmit action="createMonthly" class="save" value="${message(code: 'default.button.createMonthly.label', default: 'Create Monthly')}" /></span>
<br>
<span class="button"><g:actionSubmit action="createQuarterly" class="save" value="${message(code: 'default.button.createQuarterly.label', default: 'Create Quarterly')}" /></span>
</div>
精彩评论