Displaying 20 results from an estimated 80000 matches similar to: "getting value of collection_select"
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 Nov 04
0
Using collection_select and ajax
(I posted this earlier but it doesn''t appear on the group, so I''m
writing it again, If it appears twice, I apologize.)
I have a drop-down box that allows the user to select a language. I
want to use Ajax to render a filtered list of items based on the
language selected. I don''t want the user to press a Submit button nor
refresh the page, of course.
I''m using
2008 Jan 17
0
collection_select unique value
I have a table named "posts" with an "author" attribute. At the posts
index page, the user should be able to sort the posts through a drop
down list that contains the author name.
My problem is, when I use form option helper "collection_select", it
gives me all the authors that contained in the "field" - 3 Johns and 4
Chris -. How can I remove the
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 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
2008 Jun 19
5
observe_field
I have been trying to pass a collection_select parameter and a text field
parameter to observe_field so that it watches both the parameters
simultaneously.
but what i can see is , when i select some value from drop down and dont
write anything in text field its giving correct results.parameters are also
correct passed, but just after that if i write something in text field that
value also get
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"},
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 =>
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
2010 Jun 17
3
Can i use a hash on a collection_select? If don't, alternatives.
In my current application, i have food categories: mexican, home made,
japanese, ect
As these categories only have ID and name, no other attributes, i dont
want to create a table on the DB.
My first idea was to create a constant named FOOD_CATEGORIES, that is
has like:
FOOD_CATEGORIES = { 1=>''mexican'',
2=>''japanese'',
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
2007 Aug 20
0
FormBuilder in rjs
I have a page, which renders a partial that contains a ''State'' drop
down list. Upon change, it re-renders the ''City'' drop down, re-
populating it based on selected state_id:
Page: /customer/new.rhtml
<% form_for :customer, :url => customers_path do |f| %>
State: <%= f.collection_select :state_id, State.find(:all), ''id'',
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.