Displaying 20 results from an estimated 30000 matches similar to: "Adding to select list"
2006 Jan 25
2
select list generated from table
Have 2 tables - clients & case_managers
class Client < ActiveRecord::Base
has_one :case_manager
end
app/views/clients/_form.html contains line...
<p><% collection_select("client", "case_manager_id", \
case_manager.find_all, "name", "id") %></p>
and this line generates error...
undefined local variable or method
2005 Dec 19
1
re-selecting a select list on create
I have a select list tht is built from a "collection_select" and I want to
reselect the value the user submitted if any part of the form errors.
could someone point me in the right direction for doing this?
my select looks like this
collection_select(:company, :id, @companies, :id, :name)
I tried setting the variable @company to param[:company] but that didnt
work.
thanks
--
2007 Aug 03
2
Does collection_select work in list.rhtml?
Hi,
I have 2 models:
Model 1: er, Columns: <er_id, er_name>
Model 2: er_process, Columns: <er_id, er_process_name>
er_id is a foreign key for Model 2.
When I am creating a new er_process or editing an existing one, I have
been successful to use collection_select to show the available er''s so
that the user can select a particular er by its name (to populate the
er_id
2008 Sep 04
3
Can you use observe_field to watch a select list and then update the contents of a text field?
Before I waste more time trying to figure that out, I was wondering if
it''s even possible? The Rails Way says that observe_field by default
will trigger changes in text fields and text areas, and on clicks for
radio buttons and check boxes. So perhaps I''m using the wrong tool
here? Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you
2009 Feb 17
3
Dynamic select box
Hi everyone,
I have a problem. I want to display a different select box wether the
current user is an admin or an user.
So I thought I could do this in my view where my form is displayed :
<p class="form-input">
<%= f.label(:role_id, ''Role:'') %>
<%
if (current_user.admin?)
then collection_select(:user, :role_id, Role.find(:all, :order =>
2006 Mar 07
6
how to add onchange javascript event to select field
I would like to add javascript ''onChange'' event handling for a select
field, such as
<%= collection_select("job", "client_id" , @clients, "id", "name") %>
with onChange="xxx"
Anyone know how to make this work?
Thank you,
Scott
--
Posted via http://www.ruby-forum.com/.
2009 Aug 11
5
Dynamic drop-downs in a form_for using AJAX remote_function - Help
Hello -
I am fairly new to Ruby on Rails, but feel like I am learning quick.
I have what seems to be a fairly unique issue as I cannot find much
out there that describes what I''m seeing. Hopefully it''s a very
simple fix, and I simply can''t see the forest through all the trees!
I am attempting to create 2 related drop-down lists in the same
form_for, both using
2013 Jun 18
1
How to Pass Jquery selected dropdown values and radio button values to controller
Hi,
I have an advance search page and its code is as follows -
I have written my code like this
<div class="container">
<%= form_tag search_index_path, method: :get do %>
<%= radio_button_tag ''user_type'', ''customer'' %><p>Customer</p>
<%= radio_button_tag ''user_type'',
2007 Dec 15
3
List Box Issue - Should be easy, but nor for me!
I have the following snippet in my app:
<% @anitem = Item.find(:all, :conditions => "id = " + params[:id]) %>
<% form_for :anitem, :url => { :action => :updateitem } do |thisform|
-%>
...
... (some code...removed)
...
<%= collection_select :thisform, :item_category,
ItemCategory.find(:all), :id, :name %><br>
<%= collection_select :thisform,
2006 Apr 24
4
creating a select box
Hi
trying to create a select box in _form.rhtml.
I have a table called organisations that contains fileds, 2 being ''id''
and ''name''
these are the fields I need to bring over to the clients _form.rhtml.
whats the best way of going about that??
2 ways i have seen suggested that I cant get to work
-@organisations = Organisation.find_all placed this in def new
2006 Mar 22
1
HABTM / Dropdown Help Needed
I''m terribly new to Rails, so bear with me.
I have an application I am working on which deals with projects and
subcontractors. There can be several subs on each project and each sub
can work on several projects. I have my join table set up and
has_and_belongs_to_many in both models. If I manually put data in the
join table, this works in my show view:
<% for subcontractor in
2010 Aug 30
1
update form text_field on collection_select selection
I have form and a collection_select control. I would like to update
form fields (text box) when I select an item from the collection_select
box.
It''s like selecting template from the collection_select and the template
automatically loads to text boxes.
Any help?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
2009 Jan 15
2
collection_select not selecting default value
Hi,
I''m trying to create a dropdown using collection_select. However, I cant
seem to get it to select the right option by default.
In my controller I have a setup like this:
@content = Content.new
@content.selection_id = 3
@selections = Selection.find(:all)
In my view I have:
<% form_for :content, @content, :url => { :action => ''create'' } do |f|
%>
2007 Jan 11
4
collection_select - how to set selected options?
In a form, I am trying to use collection_select with multiple=true, like
so:
collection_select(:user, :roles, Role.find(:all), ''id'', ''name'', {},
:multiple => true) %>
My multiple select box is rendered fine, but...
I want the select to have the current role options for the user
pre-selected when I view it. So if there are five roles in the database
and
2006 Apr 21
1
select box with multiple rows
I want a select box that displays 5 rows instead of one row and a drop down.
so i figure this should work, but it doesn''t.
<%= collection_select(:constellation, :region_id, @regions, :id, :name,
html_options = {:size => ''5''})%>
I am not quite sure how to use that html_options and googling around I didnt
find anything directly on point.
Any suggestions?
2006 Apr 27
3
collection_select to display 2 fields
I''m trying to get a collection_select generated Drop-down box to display
two fields from a table (first name & last name); however, I am having
trouble concatenating the symbols. It appears as though any code I put
in the 5th argument for collection_select is processed prior to
executing the collection_select method. The code executes successfully
with 1 symbol in the 5th
2006 Jun 10
4
collection_select question
How do I specify which option should be initially selected when using
the collection_select command? I''ve tried:
collection_select(:selectionfilter, :producer_id, Producer.find(:all),
:id, :name, {:include_blank => true, :selected_value =>
@initial_selection})
However it doesn''t return the desired results (the option with the value
of @initial_selection selected).
2008 Jan 12
1
Collection_Select not showing Selected option
Hi, I''m having some problem with getting collection_select to return
the current value when editing a record. According to everything I''ve
seen, there was an issue but it''s been fixed, but I can''t figure out
why it isn''t returning the current value as a selected option. I''ve
checked the table structures, and both the call_driver.product_line_id
2006 Jun 22
2
Setting an index on a collection_select
I am creating a data entry form that allows a user to fill in multiple rows
and save them all at once. In my controller, I create an array of "person"
objects and pass it to the page. On the page, I have a text field like so:
<%= text_field "person", "name", "index" => 1 %>
Note the "index" attribute, which sets the name and id
2006 Jul 16
2
HELP - Save drop down list using "collection_select"
Each post has a single category, which I''m filling a drop down list by
using this:
#view
<p><label for="post_type_id">Category</label><br />
<%= collection_select(:id, :type_id, Type.find(:all), :id, :category) %>
</p>
In my Post model I have a field called "type_id" which is to be filled
by the id in the Type table upon