Solved

Ruby Rails form

Posted on 2014-04-04
4
269 Views
Last Modified: 2014-04-08
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 ?
0
Comment
Question by:lcor
  • 3
4 Comments
 
LVL 10

Expert Comment

by:Andrew Doades
ID: 39980136
Do you want to replace the submit button with a link_to link?
0
 

Author Comment

by:lcor
ID: 39983465
yes
0
 
LVL 10

Assisted Solution

by:Andrew Doades
Andrew Doades earned 500 total points
ID: 39983480
You'll have to use JavaScript for this then

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

Open in new window

0
 
LVL 10

Accepted Solution

by:
Andrew Doades earned 500 total points
ID: 39983484
<%= link_to 'Search', "#", :onclick => "$('#form_id').submit()" %>
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to combine and minify CSS and JS files 5 18
jQuery force form POST 7 48
on window close, not beforeunload 6 18
Do alert on select 6 15
Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question