Submit form_remote_tag with JavaScript

I’m trying to submit a form_remote_tag using javascript instead of an
input button. However, when I do this the ajax doesn’t fire on submit.
Is there a way to do this?

try sth. like this:

<% form_tag :id => “search” do -%>
<%= text_field_tag(‘search_field’, params[:query], :autocomplete
=> “on” ) %>
<% end -%>
<%= observe_field ‘search_field’, :frequency => 1,
:update => “activities”,
:url => { :controller => “your_controller”,
:action => “search”
:with => “query” %>

this will send a request to your search-method every time the user
typed sth. into the search_field.

hope this helps! smn

one more thing:
in my above example i used :update => “activities”

change “activities” to whatever the id of the element (div, table…)
is that you want to update

good luck! smn

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