Convert Form to Link

I have an empty form into a link. That is instead of having a button
initiate a get request, do it with a link.

The form looks like this:

<%= form_tag somethpath(@data), method: get, :remote => true,
:‘data-attr’ => @data.id do %>
<%= submit_tag “Search” %>
<% end %>

Is there an equivalent way to do this using link_to ?

May be you searched this?
<%= link_to ‘Search’, “#”, :onclick=>"$(’.search_form’).submit()" %>

The Rails link_to helper includes the :method => :post option, which
will invoke an unobtrusive JavaScript method to generate a form out of
your link and send it that way.

Walter

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs