Solved

Ruby Rails form

Posted on 2014-04-04
4
259 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
Comment Utility
Do you want to replace the submit button with a link_to link?
0
 

Author Comment

by:lcor
Comment Utility
yes
0
 
LVL 10

Assisted Solution

by:Andrew Doades
Andrew Doades earned 500 total points
Comment Utility
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
Comment Utility
<%= link_to 'Search', "#", :onclick => "$('#form_id').submit()" %>
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now