Forum: Ruby on Rails Search Form

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7ccb60b4e98db8841edc106c8dbf2789?d=identicon&s=25 Armitage (Guest)
on 2007-06-22 14:48
(Received via mailing list)
Hi All
this is driving me batty.
I am trying to do a search, the form I have created has radio buttons
and a text field

_full_search.rhtml
<p>Staff Number<%= radio_button_tag(:search,:staff,0) %>
NI Number<%= radio_button_tag(:search, :staff, 1) %>
File Number<%= radio_button_tag(:search, :staff, 2) %>
name<%= radio_button_tag(:search, :staff, 3) %></p>
<p><%= text_field(:search_text, "", "size"=>10)%></p>

The controller should then check which button is checked and search as
appropriate, there is placeholder text for this as the moment as no
matter which button I check, I always get the same output!
help!
controller
def staff_search
    @search_text = params[:search]
    @word = params[:search_text]
     if @search_text = "staff0"
       @word = 1
       if @search_text = "staff1"
         @word = 2
         if @search_text = "staff2"
            @word = 3
            else @word = 2
            end
          end
        end
   end
This topic is locked and can not be replied to.