问题
I have a page that shows details of a bookInstance. On that page I want to put a button that uses a g:link to show some additional details.
I've got code that works mechanically, but the button doesn't appear correctly. The button's box doesn't shrink to the size of the content and there's a funny line added to the right hand side of the button.
Here's the code I'm currently using;
<g:form>
<p><g:actionSubmit class="button" action="edit" value="${message(code: 'default.button.edit.label', default: 'Edit')}" />
<g:actionSubmit class="button" action="delete" value="${message(code: 'default.button.delete.label', default: 'Delete')}" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');" />
<g:link controller="ownedBook" action="list" params="['book.id': bookInstance?.id]" ><input class="button" value="${message(code: 'default.button.add.owner.label', default: 'Owned Copies')}" /></g:link>
<g:hiddenField name="id" value="${bookInstance?.id}" /></p>
</g:form>
Image Link
回答1:
You are wrapping an input button in your g:link. Just use the message (that forms the button label) as the g:link contents.
Do you want and anchor tag, or a button?
来源:https://stackoverflow.com/questions/6003817/grails-glink-button-appears-larger-than-other-buttons