Displaying 20 results from an estimated 80000 matches similar to: "collection_select unique value"
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|
%>
2008 Jul 30
0
getting value of collection_select
<%= collection_select(:post, :id, @posts, :id, :title, options ={:prompt
=> "-Select categories-"}, :class=>"category_dropdown_list") %>
Hi, how would I send the value of the selected item in the
collection_select?
I''m trying to use an observe_field for an input, and in the action I''ll
perform the steps corresponding to the collection_select.
2007 May 09
0
How can I specify the selected value in collection_select when fieldname different than variable?
Hi all,
I have a relatively simple scenario. I have a form that can have a
list of multiple phone objects in it. I''m trying to get the edit and
entry screens to work with unique field names. I have entry and
record creation working, but I''m still working on edit. Is it
possible for me to specify the value of the selected index to the
"collection_select" method via
2009 Mar 19
0
How to send multiple values to controller using :with option of collection_select
Hi,
Thank u all for replying my previous posts.
I have following problem
I want to send multiple selected values from collection_select using
":with" option to a controller without submitting the form, i have
following code
<%= collection_select(:cluster, :CLST_RegionID,
regions, :id, :REG_RegionName,
{:prompt => "Please Select"},
2008 Jan 13
0
Obtain selected value from collection_select
Hi
Im trying to change the layout of a view depending on the value selected
in a collection_select box dynamically. Iow the value selected must be
passed to the controller without any submit buttons beings pressed.
Ultimately I wanna know how to obtain the selected value from
collection_select and refresh this value if the collection is
changed....
Any help would be appreciated!! thx
--
Posted
2007 Apr 15
0
how to obtain the selected value from collection_select
Hi,
I''m want to obtain the selected value from collection_select and to use
it
to display something from the same table or other tables.
There is my short code :
<TR>
<TD><label for="country">country name</label></TD>
<TD><%= collection_select(:country, :country_id,
@countries, :id, :name) %></TD>
</TR>
by selecting a
2007 Nov 01
1
Default value for collection_select
Hi all,
Can we use collection_select with default selected option. I am
implementing countries and its corresponding states dropdown through
Ajax and I have used collection_select method to select countries. Now
for editing point of view I want the country which is selected earlier
should come. Please let me know if someone has any idea about this.
Thanks
Ruchita Sharma.
--
Posted via
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 May 23
0
return value from collection_select
Hi everyone
I am trying to get the return value from collection_select helper
method. Here is what I did
collection_select(''product'', ''product_id'', @products, ''id'', ''name'', {},
{:onchange => remote_function(:url => {:action => :myFunction},
:with => "this[this.selectedIndex].value")})
then in my
2006 Nov 26
0
concatenate fields in collection_select
Hi,
I am filling a collection_select with a list of models references based
on a column named "model_ref".
<%= collection_select(:assets, :model_id, @models, :id,
:model_ref,:prompt => ''- Select a model -'') %></p>
I have two issues :
1) I would like to concatenate another column next to the model
reference inside the option value with the description
2006 Aug 17
0
HABTM and collection_select
Hi,
I''m trying to use collection_select with a habtm relationship. Let''s say
you have two tables: books and authors with a many-to-many relationship.
Is there any way in rails to render something like selection boxes for
each author, so that the user can change them?
I tried this (and several more variations) but it doesn''t work:
<% for @author in @book.authors
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
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
2005 Dec 20
1
How do I persist a value in a collection_select
Hi:
I am using a collection_select to select which client''s records I
want. Everything works properly EXCEPT the list box reverts to its
initial value rather than holding onto the client whose records I am
now viewing.
?
2009 Jan 23
0
:selected option is ignored for collection_select
Is there a workaround for this issue yet? I just wasted a ton of time
trying to debug this in an AJAX form.
http://rails.lighthouseapp.com/projects/8994/tickets/1037-selected-option-is-ignored-for-collection_select
-----------
Reported by YoNoSoyTu | September 12th, 2008 @ 11:07 PM | in 2.3
The :selected option in collection_select is ignored. This patch uses
the value of :selected option if
2007 Apr 20
0
problems returning collection_select info to controller
Hi,
I''ve been working with rails for a couple of months now and I''m
beginning to understand how things work but this has got me baffled.
I want to return the user.id from a selection of a list of user
names. I followed the example from AWD w/ Rails (page 487) on how to
use collection_select but the controller barfs because it wants a user
and the id is coming back as a string.
2007 Mar 20
2
collection_select - why doesn't it work?
Hi all
I guess this is quite a newbie question, but I''m just stuck here and
don''t know why.
<%= form.collection_select :origin_country, Country.find(:all), :id,
:name %>
gives me a select list with name="member[origin_country]". When
submitting the form the following error is shown:
Country expected, got String
When I try
<%= form.collection_select
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 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 20
0
collection_select returning multiple values
Hey,
Is is possible to make collection_select return multiple values? If yes, how
can it be done?
I?ve tried:
<%= collection_select("group[]", "id", @groups, "id", "name", {},{:multiple
=> true}) %>
Leading to:
You have a nil object when you didn''t expect it!
You might have expected an instance of ActiveRecord::Base.
The error