Solved

Ruby Rails form

Posted on 2014-04-04
4
261 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

911 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

19 Experts available now in Live!

Get 1:1 Help Now