Displaying 20 results from an estimated 2000 matches similar to: "Using collection_select and ajax"
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 May 24
0
Problems validating form with collection_select
I have the following models:
class Comandancia < ActiveRecord::Base
has_many :elementos
end
class Elemento < ActiveRecord::Base
belongs_to :comandancia
validates_presence_of :nombre, :apellido_paterno, :apellido_materno,
:comandancia
end
In the view for New Elemento I''m using
<%= start_form_tag :action => ''create'' %>
<%= render :partial =>
2006 Apr 21
0
collection_select has_and_belongs_to_many update_attributes
I know there have been threads on this before but I was thinking
shouldn''t multiple collection_select automatically update habtm
relations when you update_attributes?
In order to get multiple collection_select to work I use:
collection_select(:user, :group_ids, Group.find(:all), :id,
:name,{},{:multiple=>'''',:name=>''group[id][]''})
In fact if I
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 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
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
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 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-forum.com/.
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 selected).
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 Jan 04
2
collection_select with array as source
I would like to use the collection_select with a simply array as the source
of the collection.
My array looks like this:
STATES = ["Alabama", "Alaska", "Texas"]
and it is stored in my environment.rb
I can''t figure out the syntax for the collection_select in this situation...
collection_select("my_object", "state", what goes here??? )
I
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.
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|
%>
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 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 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
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
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",
2011 Feb 17
1
(no) new join table entry by collection_select
Hi there
../view/trainings:
in my _form.html.erb I use a collection_select to get the id of a
worker from Worker-table.
<%= collection_select(:worker, :id, @workers, :id, :first_name,
options ={:prompt => "Select a worker"}, :class =>"worker") %></div>
The collection select shows correct, but there will be no entry in the
worker_id field of the new entry.