similar to: simple collection_select problem.

Displaying 20 results from an estimated 10000 matches similar to: "simple collection_select problem."

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| %>
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_select for every date entry? thanks
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
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'',
2006 May 22
15
collection_select default selected value
Hiall, Unfortunately I just can''t find out how to setup a default selected value when using collection_select. My call is like so: <%= collection_select(:consultant, :lastname, @consultants, :id, :lastname, { :selected => @current_consultant.id } ) %> which is not working, I debugged so far that I know that @current_consultant.id contains the correct value. Any tips? cheers
2006 Apr 26
2
Multiple Select example?
I''ve been trying to sort out a multiple select dropdown but haven''t found any good examples - anyone know of any or perhaps could make a suggestion [see below] Model: 1. Task AR has_many users 2. User AR belongs_to task login/password attributes Controller: View: <%= collection_select("task", "users" , @users, "id", "login", {},
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 Jul 03
1
how to get value from the post on the List page
Hi, I''m new to Rails. I''m building a candidates tracking system for recruiting. I have a List page, but instead of listing every candidate, I only wanted to list the candidates in certain statuses. The first time List page is hit, by default, it lists candidates in status < 9. But on the List page, there is a dropdown where all the statuses are listed, so that when user
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 Jun 05
2
dropdown
I''m using a dropdown on my form for a simple cms which displays the pages from the database. I want to add some options to the dropdown that are not in the database. Is there a way to do this? Here''s my code so far: <p><label for="navigation_link">Link</label><br/> <%= select("navigation", "link",
2006 Feb 28
2
Need help with a Power Find()
I was hoping someone would be able to help me with creating a method. I have two tables. What I am trying to do is create a list of all the id''s from table2 that aren''t currently referenced by Table1''s address_id column. That way, when I create a new customer I can have a drop down list in the view of all the addresses that are not currently being used. ##### Database
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 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
2006 Apr 22
6
nOOb question: How to use find_all with form input data
Hello, I''m having a problem utilizing the find_all method with a value from a form. I keep getting the following error: Mysql::Error: #42S22Unknown column ''category_id11'' in ''where clause'': SELECT * FROM items WHERE (category_id11) The controller seems to be getting the correct data, but my key and value seem to be mashed together(it''s
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 Mar 18
10
collection_select''s linked
I created a form with two collection_select, country and state and would like to bring up to date the state list when to select a new country. How I can make this in Rails? Thanks Eleudson Brazil <p><label for="person_country_id">Country</label><br/> <%= collection_select(:person, :country_id, @countries, :id, :name) %></p> <p><label
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
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, evalScripts:true});"}) %><br> <%= render :partial =>
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
2006 May 26
4
What association do I want here, has_ or belongs_to?
I thought I had a handle on this one but it''s causing me grief and I''m hoping somebody can set me straight. I have an object AlertTemplate which will contain a fill in the blank style hunk of web content. I then have an object, Alert, which will have a relationship to one of those AlertTemplate objects, plus some data. So, in human speak, I''d think that an Alert