similar to: how to obtain the selected value from collection_select

Displaying 20 results from an estimated 40000 matches similar to: "how to obtain the selected value from collection_select"

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
2009 Jan 28
3
Apply style in collection_select ?????
Hi to all, i have this snip i want to apply style to this combo but there is no effect help....... <%= collection_select(:customer,:country_id, @countries,:id, :country, html_options={ "style" => "width:110px" },:onchange => ''updateState('''');'',:id =>''country_id'' )%> Thanks, -- Posted via
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
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 Jul 17
0
collection_select help
I can''t figure out how to get the collection_select to correctly identify and select the appropriate option in the drop down to begin with. i have checked that charge.offense_level contains the correct value to begin with (a number between 1 and 10) but the view still defaults to the first option and not the one contained in the charge.offense_level. what am i doing wrong? any
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
2006 Apr 26
3
drop downs
I''m having trouble getting a second drop down populated based on the value from the first drop down. I''ve tried following some of the examples posted, but haven''t had any success. I''m new to RoR so any help would be appreciated. When the first drop down''s value gets changed, it calls the correct method in the controller and even finds the correct
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
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
2009 Aug 14
0
country select with i18n
I am trying to manage the country names with i18n. I have a countries table with the countries extension codes (us., co., ve., .bo. etc...) and the yml files with their complete names: en: countries: ar: Argentina co: Colombia . I am trying to make a form with a select option for country and came up with this: <%= f.select("country_id", Country.all.collect {|p| [ t
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: <%
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 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
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 Jul 02
1
multitable form
Hi all, Although I''m experienced with programming I''m a beginner with ruby, RoR and MVC So I follow examples from books and so on and all is ok. I can make a model who is a class and who match to a table in my database and then I generate pretty forms on a webpage. I would like to know how I can do to make forms who interact with more than one table. For an example lets
2012 Mar 28
1
collection_select
_form.html.haml = f.label :Select_Brand, "Select_Brand<em>*</em>".html_safe = collection_select(:brand_name, :brand_id, Brand.all, :id, :name, :prompt => "Select a Brand" ) show.html.haml file %table %tr %td Brand_Name : %td = @message.brand_id After writing this code I am not able to see the brand name. Its not giving any error but
2012 Nov 17
2
Help needed for error in foreign key validation
I have two models bank and country. User should only associate a Bank with a country id present in the country table and I put validates presence of country to enforce it but i get error mysql2::Error: Unknown column ''countries.bank_id'' in ''where clause'': SELECT `countries`.* FROM `countries` WHERE `countries`.`bank_id` = 17 LIMIT 1 when updating the bank
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,
2007 Apr 25
2
form_remote_for, reloaded
Hi, being relativly new to RoR, I''m having a problem which I found described in this forum and somewhere else - but with no solution. I know, that it may be bad to mix table and form tags, but the first solution of an in place editing within a table looked nice: Version using form_for: <tr> <%form_for :time_record, :url => { :action => "add_time_record" } do
2011 Mar 10
4
Multi-model forms
Hi guys, I''m new to ruby and rails and I''m working on multi model forms, specifically 3. I''m using this http://guides.rubyonrails.org/getting_started.html as a start, and its got a 2 Model example but I cant seem to get the last one working. These are my models: Country name:string code:string (has_one :address) Address address_line1:string