Ruby Rails form

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 ?
lcorAsked:
Who is Participating?
 
Andrew DoadesConnect With a Mentor IT TechnicianCommented:
<%= link_to 'Search', "#", :onclick => "$('#form_id').submit()" %>
0
 
Andrew DoadesIT TechnicianCommented:
Do you want to replace the submit button with a link_to link?
0
 
lcorAuthor Commented:
yes
0
 
Andrew DoadesConnect With a Mentor IT TechnicianCommented:
You'll have to use JavaScript for this then

<%= link_to 'Save', "#", :onclick=>"$('.search_form').submit()" %>

Open in new window

0
All Courses

From novice to tech pro — start learning today.