Displaying 20 results from an estimated 4000 matches similar to: "How to have multiple fields appear in collection_select?"
2006 Mar 14
2
Nubie: collection_select with two fields concatenated
I have a table with (among others) :prefix and :lastname
In my view in a collection_select I want to see "prefix lastname". I
have ab-so-lu-te-ly no idea how to do this. Can anybody show me?
--
Posted via http://www.ruby-forum.com/.
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 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 Jan 05
7
HOWTO: Combine fields from 2 two tables in 1 object
Hi all,
For a dropdownlist (showing "Company - FirstName Lastname'') I want to fill an
object @project_contacts with "Name" from table Companies and "Firstname" and
"Lastname" from table contacts. Any idea?
Regards,
Gerard.
--
"Who cares if it doesn''t do anything? It was made with our new
Triple-Iso-Bifurcated-Krypton-Gate-MOS
2006 May 15
2
collection_select and validation problems
I keep getting the error below when I use validations with
collection_select.
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.inject
Extracted source (around line #22):
19: <td>Vendor</td>
20: <td>
21: <!-- vendors -->
22: <%=
2006 May 24
4
pdf on the fly
In my rails app I need to create pdf reports on the fly. I have
installed railspdf, wich is working fine. But, how can I create tables
and paragraphs and stuff? Can I mimic an .rhtml file (using <% for
...%> etc? Or is it wise to use Ruby::PDF directly? Is there anyone out
there with experience in this, and who is willing to share his findings?
Thx
--
Posted via
2006 Feb 26
2
auto_complete on steroids
I am trying to get more out of auto_complete than it apparently was
designed to deliver.
My problems seem to be two fold.
1 - I use aggregations on
names... :first_name, :middle_initial, :last_name and then aggregate
them using a composed_of :wholename thing
auto_complete_for seems to be wired to only use table columns directly
and gags on the aggregate form.
2 - foreign table columns -
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 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
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
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
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
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 =>
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 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 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_select(:name, @users, :id, :name)
%>
I went through the api docs
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 =>
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 | form |
form << content_tag("b",
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
2011 Oct 10
2
Collection_select
Hi,
I''m new using RoR and I have a ... trouble with
f.collection.select
What I have in a table is ... for example
group code
GroupA 07A
GroupA 08A
GroupA 10B
GroupB 06A
GroupB 11B
GroupB 07B
GroupC 10A
GroupC 09A
GroupC 09B
when I use
<%= f.collection_select :grupo, Equipo.find(:all), :id, :name, prompt:
''Choose a Group'' %>