Select the item


#1

hi
i am new to ruby and i have one text box for search by the string in
the text box
insted of that i am trying to implement a drop down list,with the
selected item in the drop down it should search. problem hear is that
the search is not going by the item please help me

The code is:

insted of this i tryied
<%= select_tag ‘category’,options_for_select([[‘ALL
RESIDENTIAL’],
[‘ALL COMMERCIAL’],
[‘Commercial Land’],
[‘Industrial Building’],
[‘Industrial Shed’],
[‘Farm House’]], to_s), :onchange =>
“content.category(this,notnull ) ;” %>

please help me…
Thank you.


#2

hi ,

i want to do the same search for my applicaion.

presently i can search the database by typing the string in the search
box.
But now i want to provide a dropdown box of search parameters instead
of typing.
here my search application is usin ajax .

take a look at my search code:

in index.html.erb

Search:
<img id=“spinner” src="/images/indicator.gif" style=“display: none;” /


<%= observe_field ‘search_form’,
:frequency => 0.5,
:update => ‘results’,
:url => { :controller => ‘streams’, :action=> ‘get_results’ },
:with => “‘search_text=’ + escape(value)”,
:loading => “document.getElementById
(‘spinner’).style.display=‘inline’”,
:loaded => “document.getElementById(‘spinner’).style.display=‘none’”
%>

the search mthod defined in controller is

def get_results
if request.xhr?
if params[‘search_text’].strip.length > 0
terms = params[‘search_text’].split.collect do |word|
“%#{word.downcase}%”
end
if blank?
flash[:notice] = ‘Stream was successfully updated.’
else
@streams = Stream.find_tagged_with(params[:search_text])
end
end
render :partial => “search”
else
redirect_to :action => “index”
end
end

Can you help me hoe can i do this.

thnaks for any suggetions and help

regards
Srikanth.

On Jan 22 2007, 10:13 am, Dilip Bv removed_email_address@domain.invalid