views:

246

answers:

3

I'm working on a grails application and I've kept looking for some solution to my problem for the past 15minutes - I guess, there's an pretty simple solution to this...

The point is, I have a view where I have a g:link tag - it works fine, but the visuals are kind of ugly. Therefore I want to disguise that g:link thingy with a normal button....

Ive tried a span class and input type="button" but this did not do the trick. A g:form with some action and a action submit is not really what I'm looking for.

Any help is really appreciated!

+1  A: 

I think you'll need to use some javascript on the button and the javascript onClick method to perform the linking. A good alternative is to make a nice looking image instead.

If you want to avoid javascript then just use a form with method GET

Not really grails specific but you can probably do it quite easily with g:form somehow (I'm only just getting started with Grails myself)

EDIT: Re-reading your post, the most important thing to note is that I used input type="submit" which calls the action field in the form rather than just being a button.

grahamrb
+2  A: 

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.

Amit Jain
very nice - that worked like a charm!
Gnark
A: 

I think using the link and button will actually cause the button to fire twice !! Not recomended if you are doing some work off the back of it ..

rob morning