0

I am trying to follow the advice from this question, on how to make an input field act like a link.

I have setup the form, and setup the URL.

Yet, when I click the input fields, nothing happens. It does not redirect me, and there is no console errors.

Any ideas on how to make this work?

Rendered source:

 <form action="/ads/edit" style="display:inline;" method="get">
                <input onclick="_gaq.push(['_trackEvent', 'Frontpage_Top_SaleBtn', 'click'])" type="button" class="button_green_big" value="Sælg virksomhed" />
            </form>
            <form action="/ads/editbuy" style="display:inline;" method="get">
                <input onclick="_gaq.push(['_trackEvent', 'Frontpage_Top_BuyBtn', 'click'])" type="button" class="button_green_big" value="Køb virksomhed" style="margin-left: 10px;" />
            </form>

My ASP.NET MVC code that renders this:

 <form action="@Url.Action("Edit","Ads")" style="display:inline;" method="get">
                <input onclick="_gaq.push(['_trackEvent', 'Frontpage_Top_SaleBtn', 'click'])" type="button" class="button_green_big" value="Sælg virksomhed" />
            </form>
            <form action="@Url.Action("EditBuy","Ads")" style="display:inline;" method="get">
                <input onclick="_gaq.push(['_trackEvent', 'Frontpage_Top_BuyBtn', 'click'])" type="button" class="button_green_big" value="Køb virksomhed" style="margin-left: 10px;" />
            </form>
Community
  • 1
  • 1
Lars Holdgaard
  • 9,496
  • 26
  • 102
  • 182
  • 1
    possible duplicate of [Firing a google analytics event on form submit](http://stackoverflow.com/questions/19498046/firing-a-google-analytics-event-on-form-submit) – DavidG Sep 11 '14 at 08:36
  • The link worked - thanks. I would suggest maybe keeping this one open, so Googlers can find the answer. You don't think "oh it's Google analytics" right of the hook.. – Lars Holdgaard Sep 11 '14 at 08:54

1 Answers1

1

as noted in one of the answers to the question on which you are referring

<form action="http://google.com">
    <input type="submit" value="Go to Google">
</form>

Set your inputs type to 'submit' instead of 'button'

aleha_84
  • 8,309
  • 2
  • 38
  • 46