type to search

How to update a label when the contents of a field is changed in Rails 3

Asked by

Observe_field is not present in Rails 3, it is available as part of a plugin. However, I would like to use the Rails 3 UJS style to get a similar functionality.

Here is my code, following tips from this blog post:

// _form.html.erb:

  // script inside _form: $document.ready(function($) { // when the #search field changes $("#xpath_to_title").change(function() { // make a POST call and replace the content $.post(, function(data) { $("#title").update(data); }); }); })

I added this match:

// routes.rb
  match '/:execute_query(.:format)' => 'vendors#execute_query', :as => :execute_query

But I get this routing error:

No route matches {:controller=>"vendors", :action=>"execute_query"}
or Cancel

1 answer

Your answer

You need to join Shapado to complete this action, click here to do so.