search for: collection_select

Displaying 20 results from an estimated 207 matches for "collection_select".

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...
2005 Jan 25
4
Collection_select with multiple options
Hi, I have built a select field that allows multiple options selected with collection_select and "multiple"=>"multiple". How do I go about receiving the values? If I use a variable name like collection[], it complains that I can''t use @collection[] as the instance variable. TIA victor
2006 Jun 22
2
Setting an index on a collection_select
...ot;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 correctly. I would like to do the same with a collection_select, but can''t seem to get it to work. Does anyone know if there is an elegant way to set the "index" attribute of a collection_select? Something like: <%= collection_select(''person'', ''type'', @person_types, ''id'', '...
2009 Aug 11
5
Dynamic drop-downs in a form_for using AJAX remote_function - Help
...ms 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 collection_select. On the first drop-down, I have an onChange "remote_function" call that I want to send an AJAX call to the controller and filter the list in the 2nd drop-down based on what was selected in the first. In the controller method, I then call page.replace_html to render a partial. In the part...
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 field of er_process), like this: <% form_tag({:action => ''create''}) do -%> <label for="er_id">ER ID: </label> <%= collection_se...
2006 Jul 16
6
using collection_select
hello, supposing i have a User class that contains a Wibble class User < ActiveRecord::Base has_one :wibble end in my view i have <%= collection_select :user, :wibble, Wibble.find(:all), :id, :name %> when i post, i get an error like "Wibble expected, got String" how/where am I supposed to convert this posted wibble_id into a Wibble, or am I using collection_select incorrectly? i''ve seen some suggestions to use :wibble_id...
2012 Sep 13
3
Creating a link_to from a collection_select
I want to be able to change one attribute of a link_to to be what is the current selection of the collection_select. And needless to say I can''t quite figure it out. app/views/tasks/show.html.erb Who would you like to assign this task to?<br /> <%= link_to ''Myself'', :controller => ''task_queues'', :task_id => @task.id, :action => ''assign...
2006 Aug 16
1
how to update a collection_select from another
I have two collection_select in my list.rhtml: <%= collection_select (:region, :id, @regionall, :id, :title,html_options={:onChange => "new Ajax.Updater(''related_provinces'',''/categories/related_provinces/" + "?id=''+this[this.selectedIndex].value, {asynchronous:true,...
2006 Aug 17
3
Use collection_select
I use the following code in my view: <%= collection_select(''datedata'', ''date'', @allDate, :id, :date) %> It''s show me the date of all entries in the database (Dropdown menu). Additional, I wrote a helper method "showDate" in the application_helper.rb! How can I use this method in the collection_s...
2006 Nov 28
2
collection_select and selected_value
Hi, I am using collection_select to build a drop down list. I would like to have the current value selected. How can I do that? My current code is straight from the example in Pragmatic Programmers book [2nd ed, p480] copying here for reference. <%= @users = User.find(:all, :order => "name" ) form.collection_se...
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...
2006 Nov 29
5
Collection_select with two columns and a prompt
Hello, I am quite a newbie to RoR, I hope you maybe able to help. I have a collection_select in a _form.rhtml: "collection_select(:assets, :model_id, @models, :id, :model_ref,options={:prompt => ''- Select a model -''})" As you see my drop down menu will show the model_ref column. 1) Is it possible to have more than one column. For example I would like to con...
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 select...
2005 Jan 21
2
collection_select
I''m trying to use collection_select, but it''s not working as I expect. The list populates correctly but the current value is not selected. @question contains a topic (via topic_id), and @topics is the list of all topics. Here''s my attempt to create a drop-down list of the topics. form("question") do...
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 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...
2006 Apr 25
1
simple collection_select problem.
Hi, I can do this : collection_select "state", :id, TrainingState.find_all,:id,:name but not this : collection_select "state[]", :id, TrainingState.find_all,:id,:name Anyone any idea why? Is there something about collection_select that does not allow collections? Thanks Chris -- Posted via http://www.ruby-fo...
2013 Jun 18
1
How to Pass Jquery selected dropdown values and radio button values to controller
...39;' %><p>Customer</p> <%= radio_button_tag ''user_type'', ''supplier'' %><p>Supplier</p> <% end %> <h2>Search Criteria</h2> <div id="dropdown"> <p>State</p> <%= collection_select(:customer, :customer_number, Customer.all, :id, :state) %> <p>City</p> <%= collection_select(:customer, :customer_number, Customer.all, :id, :city) %> <p>Name</p> <%= collection_select(:customer, :customer_number, Customer.all, :id, :name) %>...
2007 Dec 22
3
collection_select validation problem
I''m trying to assign a parent foreign key value using collection_select from my child "new" form. The problem I''m having is if I do not make a selection, I get the following error instead of the Rails validates_presence_of error: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occur...
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 vie...