FontAwesome with Grails <g:actionSubmit

前端 未结 2 1628
面向向阳花
面向向阳花 2021-01-19 12:15

I\'ve been trying to add icons to my save, delete, etc. buttons. I have about five buttons using the tag to call an action in a controlle

相关标签:
2条回答
  • 2021-01-19 12:28

    Don't use actionSubmit, just use a <button> and provide the link/action properties like so:

    <button type="submit" class="btn">
      <i class="..."></i> Update
    </button>
    

    here's a more detailed example

    <button type="submit" class="btn btn-danger" name="_action_delete" value="Delete">
      <i class="..."></i> ${message(code: 'default.button.delete.label', default: 'Delete')}   
    </button>
    

    Note: actionSubmit passes the following input name/values for update, save and delete

    name="_action_update" //update
    name="_action_update" //save
    name="_action_delete" //delete
    

    so you would just need to do the same if you're app is dependent on them

    0 讨论(0)
  • 2021-01-19 12:41

    Try passing the class name to remoteLink, which creates a link that uses Ajax to call a remote function and you can add your fontAwesome classes to it.

    <g:remoteLink  class="btn icon-ok" action="index"  >
        click (without i tag)
    </g:remoteLink>
    

    or

    <g:remoteLink  action="index" >
           <i class="btn icon-ok">click (with i tag) </i>
    </g:remoteLink>
    

    Both approaches should work. enter image description here

    0 讨论(0)
提交回复
热议问题