similar to: country select with i18n

Displaying 20 results from an estimated 7000 matches similar to: "country select with i18n"

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
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
2011 May 17
0
Select not maintaining state on nested form with
I am using nested forms with multiple instances of various of the forms. The problem I cant figure out is how to maintain state for the select between postbacks. I am using ''options_from_collection_for_select'' and in this the last param is to be the selected value, but given the dynamic nature, the value is going to depend on the iteration of the form builder. If I manually force
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).
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 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
2012 Mar 31
2
I18n.t('countries.NO') broken?
Hi I''ve tried this on a virgin Rails 3.2.2 app. If you put the translations for country names in the locale file using the 2 letter ISO code, it looks something like this: en: countries: DE: "Germany" NO: "Norway" US: "USA" This works fine - but for Norway :-) I18n.t :''countries.DE'' # => "Germany" I18n.t
2006 Aug 13
0
selected_value or select not work
I''am try using collection_select helper, but the option selected_value not work i try like this: <%= collection_select("user", "gender_id", @genders, "id", "description", {:include_blank => true, :selected_value => "2"} []''s Bruno -- Posted via http://www.ruby-forum.com/.
2006 May 15
0
collection_select and API docs questions
Hello, I''m wondering where in the docs am I suppose to find a complete list of options for the collection_select helper? For instance the API docs have an example for the select helper as below: select("post", "person_id", Person.find_all.collect {|p| [ p.name, p.id ] }, { :include_blank => true }) Where the heck do I find valid values for the options and
2006 Jul 20
0
Getting joined collections on a form
Greetings, I''m looking for suggestions on how to simplify getting customer addresses on a form: I''m jumping between controller and view several times; alternating between rhtml and rjs, in order to display customers and their addresses on an invoicing form. It''s very messy. I have a one to many relationship between Customer and Addresses, each customer has one or more
2006 Jul 21
0
Selecting customers and addresses in a form (was Getting joined collections on a form)
(Sorry if you have received this twice, I''m having trouble sending mail to the rails list) Greetings, I''m looking for suggestions on how to simplify getting customer addresses on a form: I''m jumping between controller and view several times; alternating between rhtml and rjs, in order to display customers and their addresses on an invoicing form. It''s very
2006 Aug 17
1
2 newbie question
Hey all, I have 2 newbie questions, 1st question: <%= collection_select (:region, :id, @regionall, :id, :title,options={:prompt=>"- Select cat -"}) %> Ignores the :prompt part while options={:include_blank => true} works. Any idea what I?m doing work with :prompt ? 2nd question: How can make my collection_selected to display it''s third key by default? I know it has
2009 Jan 08
4
Problem with disable_with
Hi Group, I have a registration.html.erb page with the following JavaScript at the top which I use to validate form fields: <script type="text/javascript"> <!-- function validate(){ if ((document.myForm.email_projectname.value=="")|| (document.myForm.email_projecttype_id.selectedIndex<1)|| (document.myForm.email_region_id.selectedIndex<1)) { alert
2010 Feb 22
3
Rails 2.3.5/Ruby1.8.7 Collection_Select Labels with ampersands "&"
I am having an annoying problem displaying the labels of a select box correctly where there is an ampersand contained within the label string. On a form being rendered with the form_for helper the collection_select reads data from a Mysql 5.075 database the text stored in the database is "Surabaya & Surrounding Areas" when rendered and displayed in firefox 3.6 or safari is is
2007 Jul 31
3
country listbox from table
sorry again, i''m building a registration form, getting stumped on the country listbox. any ideas how i could build a listbox for countries, taking it''s content from a data table? i''d imagine i''d have to generate a data model for country, fill it in with all the current ISO spec countries; that i can do. then tie that data model to the account controller.
2007 Dec 22
3
collection_select validation problem
I''m trying to assign a parent foreign key value using collection_select from my child "new" form. The problem I''m having is if I do not make a selection, I get the following error instead of the Rails validates_presence_of error: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occurred while evaluating
2012 Aug 16
6
undefined method `with_indifferent_access' for "":String
Hi I''m having a issue with one object when try to update the attributes in this object previously saved in the database I have one object comp and one object reg they have this relationship comp has_many regs reg belongs_to comp when run use the method valid? like this current_contribuyente.comps.build(params[:comp]).valid? it returns: IndexError (string not matched) And when
2010 Jan 28
1
validates preference of at least one param
I have a simple RESTful search scaffold that finds data in a separate model and controller. [code] <h1>New search</h1> <% form_for(@search) do |f| %> <%= f.error_messages %> <p> <%= f.label :category_id %><br /> <%= f.collection_select :category_id, Category.all, :id, :name, :include_blank => true %> </p> <p> Age