Forum: Ruby on Rails select the item

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Dilip B. (Guest)
on 2007-01-22 07:13
 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:
<input type="text" name="query" value="<%= h @query %>" /></h4>
 insted of this i tryied
        <%= select_tag 'category',options_for_select([['ALL
                      ['ALL COMMERCIAL'],
                      ['Commercial Land'],
                      ['Industrial Building'],
                      ['Industrial Shed'],
                      ['Farm House']], to_s),  :onchange =>
"content.category(this,notnull ) ;"  %>

please help me....
 Thank you.
srikanth (Guest)
on 2008-12-12 07:33
(Received via mailing list)
hi ,

i want to do the same search for my applicaion.

presently i can search the database by typing the string in the search
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: <input type="category" id="search_form" name="search" />
<img id="spinner" src="/images/indicator.gif" style="display: none;" /
<div id="results"></div>
<%= observe_field 'search_form',
  :frequency => 0.5,
  :update => 'results',
  :url => { :controller => 'streams', :action=> 'get_results' },
  :with => "'search_text=' + escape(value)",
  :loading => "document.getElementById
  :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|
          if blank?
          flash[:notice] = 'Stream was successfully updated.'
          @streams = Stream.find_tagged_with(params[:search_text])
        render :partial => "search"
        redirect_to :action => "index"

 Can you help me hoe can i do this.

thnaks for any suggetions and help


On Jan 22 2007, 10:13 am, Dilip Bv <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.