Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to incorporate a g:link into an ordinary button?

In my grails application there is a view with a a g:link tag - it works fine, but the visuals are kind of awkward. Therefore, I want to disguise that g:link with an ordinary button.

I've tried a span class and input type="button" but this did not do the trick.
Side note: I don't want a g:form with an submit action.

Any help is really appreciated!

like image 732
Gnark Avatar asked Dec 23 '22 09:12

Gnark


2 Answers

g:link tag does nothing but at the end creates the anchor tag. So anything that you can put inside anchor tag, so with g:link.

You can simply write. <g:link class="create" action="create"><input type="button" /></g:link>

It appears to be a button to user but does the job of g:link tag.

like image 159
Amit Jain Avatar answered Dec 24 '22 23:12

Amit Jain


Amit Jain's answer worked but had some problems in ie 8 & 7 (looked like some kind of style overlapping error). This solution worked in all browsers I tested

<button class="class" onClick="window.location = 'www.location.com' ">
    <g:message code="share.learnmore"></g:message>
</button>
like image 32
RasTheDestroyer Avatar answered Dec 24 '22 22:12

RasTheDestroyer