Displaying 20 results from an estimated 2000 matches similar to: "Apply style in collection_select ?????"
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
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 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
2006 Mar 07
6
how to add onchange javascript event to select field
I would like to add javascript ''onChange'' event handling for a select
field, such as
<%= collection_select("job", "client_id" , @clients, "id", "name") %>
with onChange="xxx"
Anyone know how to make this work?
Thank you,
Scott
--
Posted via http://www.ruby-forum.com/.
2012 May 28
4
How to load a selection list into the method new of a controller?
Hi friends!
I''m relatively new with Rails and I''m struggling for a long time with this
problem (it should have a pattern solution but until now I didn''t find it):
I have the following models: Institution, City, State and Country.
class Country < ActiveRecord::Base
has_many :states
has_many :cities, :through => :states
end
# == Schema Information
# Table
2006 Jul 28
3
Forms: handle foreign keys (AssociationTypeMismatch)
Hi all
I tried and tried and tried, but I still fail in creating a form with
proper validation and stuff for foreign keys... So I''d really like to
get some help here.
I''m creating a booking site for DJ''s, and for every booking one can
choose one of different countries:
class Booking < ActiveRecord::Base
validates_presence_of :country_id
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
2008 Sep 04
3
Can you use observe_field to watch a select list and then update the contents of a text field?
Before I waste more time trying to figure that out, I was wondering if
it''s even possible? The Rails Way says that observe_field by default
will trigger changes in text fields and text areas, and on clicks for
radio buttons and check boxes. So perhaps I''m using the wrong tool
here? Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you
2010 Mar 26
7
seed data
Hi
I am using seed_fu to seed initial data to tables
(http://github.com/mbleigh/seed-fu) . And in db/fixtures/state.rb
I have values like (I am filling only two data for simplicity)
State.seed_many(:name, :abbr,:fips,:country_id, [
{ :name => "Alberta", :abbr => ''AB'',:fips => ''01'', :country_id =>
2 },
{ :name =>
2010 Aug 02
1
Drop down boxes from table data
Hi
I have another question for how best to do this. Now I have been
following the tutorial at:
http://www.tunaslut.com/learning-ruby-drop-down-lists-in-one-to-many-relationships,
however when I change the view over from
<% @cities.each do |city| %>
<tr>
<td><%=h city.city_name %></td>
<td><%=h city.country_id %></td>
to:
<%
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
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 Jun 16
4
Form magic
Didn''t know what else to call this subject, sorry.
Anyway this is more a general discovery question then a coding one.
Is it possible (and I already know it should be) to create forms where
depending on a particular choice in one select tag, one or another
select tags would be presented in the form.
As an example, a shopping site , where a dropdown has options of:
1-Men''s shoes
2009 Aug 11
5
Dynamic drop-downs in a form_for using AJAX remote_function - Help
Hello -
I am fairly new to Ruby on Rails, but feel like I am learning quick.
I have what seems to be a fairly unique issue as I cannot find much
out there that describes what I''m seeing. Hopefully it''s a very
simple fix, and I simply can''t see the forest through all the trees!
I am attempting to create 2 related drop-down lists in the same
form_for, both using
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 14
4
Select box onchange problem
Hi,
i''ve got the following problem. I have a check_box witch shows
a list of varieties. Now i want to call a action when the user
changes his selection. (the method to be called, will store the
selection from the user).
This is my code:
<%= select(''variety'', ''variety_id'',
Variety.find_all.collect {|c| [c.description, c.id]},
2007 Nov 07
5
Unexplainable failure...at least for me
I have an address model with country_id and province_id fields
There is also a full_address method that returns an address that is in a
format that the google maps api will be able to return a long-lat
coords.
Within the full_address method there is a call to obtain the
province/state and country name.
---------
def full_address
...
full_address = [city, self.province.name,
2010 Nov 09
2
Undefined method
I am very new to ROR. (Ruby 1.8.7, rails 2.1.1, rack
0.8.7, mysql 5.1.41)
I has my_app/lib/migration_helpers.rb file:
module MigrationHelpers
def self.foreign_key(from_table, from_column, to_table)
constraint_name = "fk_#{from_table}_#{to_table}"
execute %{alter table #{from_table}
add constraint #{constraint_name}
foreign key (#{from_column})
2008 Mar 29
3
primary key?
can you use 2 pirmary keys.
the standard user_id key exists but i would also like to use another
key for my links. i am not sure how to implement this. also i don''t
want any auto incrementing of this second primary key that i would
like to use for my relationships.
if there is a good db, model, relationship tutorial out there i would
love to know about it.
2006 Jul 07
3
dynamically updating a listbox from another listbox
Hi,
I would like to be able to dynamically (without reloading the page)
change the values from one listbox when a user select items from another
listbox. I have a model ''Sector'' which has_many ''levels'' (and of cours,
''Level'' beyong_to ''sector''). I want to show the user two listboxes with
the sectors and levels. But