new on rails, i am having problem in passing select_tag value(in the
view file) to controller.

my view controller file is like

class ProjectStatusController < ApplicationController

def index
@projects = Project.find(:all, :select => "name")
end

def show
lookup = params[:project]
@rows = Project.find_by_lookup(lookup)
end
end
and view file is like

<% form_tag("project_status", :controller => "ProjectStatus", :action
=> "show", :method=>'get' ) do %>
<%= select_tag 'project',
options_from_collection_for_select(@projects,"id", "name"),:onchange
=> "this.form.submit();" %>
<% end %>
<%
if !@rows.nil?
@rows.each do |row|
end
%>
<%= row[:name] %>
<% end %>

what i basically want to achieve is this - based on the selected value
from select tag i want to display information(on the same view page)
of selected item from the database

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedJan 18, '12 at 5:10p
activeJan 18, '12 at 5:10p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Hitesh: 1 post

People

Translate

site design / logo © 2021 Grokbase