Hello everyone. I''m doing something similar to the AJAX based search
facility presented the Friends of ED book, but it doesn''t work for
non-javascript browsers, so I''m trying to improve it.
The search engine looks like:
<% form_remote_tag :url => { :action => :search } do %> #For non
AJAX
Search: <%= text_field "product", "search" %>
<%= submit_tag "Buscar" %>
<% end %>
<%= observe_field :product_title,
:frequency => 1.0,
:update => ''products'',
:url => { :controller => ''store'', :action=>
''search'' },
:with => "''search='' + encodeURIComponent(value)"
#AJAX
%>
And this action checks if ''search'' has something similar to
any
product title in the DB:
def search
@products = Product.find(:all,:conditions => ["lower(title) like
?","%" + params[:search].downcase + "%"])
(...)
end
Searching for "traxxas" with JS enabled works, and it prints in
development.log the following:
Parameters: {"search"=>"traxxas",
"action"=>"search",
"controller"=>"store"}
With JS disabled development.log shows:
Parameters: {"commit"=>"Filter products",
"product"=>{"search"=>"traxxas"},
"action"=>"search",
"controller"=>"store"}
So I can''t accede to "search"=>"traxxas", which
is inside product,
from the search action (params[:search].downcase gets nil.downcase).
How can I figure this out?
Thanks in advance;
Eugenio Costa.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---