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 http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi, Try this: <%= collection_select(:customer, :country_id, @countries, :id, :country, {:style => ''width:100px;'', :onchange => "updateState('''');", :id => ''country_id''}) %> Argument list is: name of instance variable (@customer becomes the symbol :customer), name of attribute (@customer.country_id becomes :country_id), then the array of objects (@countries), then the id method to send each of these (ie send them all "id" to get the id of each object), then the display method ("country" in this case, which seems a bit odd to me, it''d probably be name rather than country... ), then a HASH OBJECT (represented by {} braces) which has html options in it. The html_options= simply assigns a temporary variable to be the hash... so you don''t need it, because you''re not using it elsewhere. Good luck! http://sensei.zenunit.com/ http://random8.zenunit.com/ On 28/01/2009, at 6:06 PM, Dharmdip Rathod wrote:> > 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 http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks a lot , but it is not working here actually your suggested code is breaking my java script and style problem is still there , but never mind . Actually here this issue is looking some critical because i can not see html generated code in source when i write this <%= collection_select(:customer, :country_id, @countries, :id, :country, {:style => ''width:100px;'', :onchange => "updateState('''');", :id => ''country_id''}) %> help............... -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 28 Jan 2009, at 07:34, Dharmdip Rathod wrote:> > Thanks a lot , > but it is not working here actually your suggested code is breaking my > java script and style problem is still there , but never mind . > Actually > here this issue is looking some critical because i can not see html > generated code in source when i write this > > <%= collection_select(:customer, :country_id, > @countries, :id, :country, {:style => ''width:100px;'', :onchange => > "updateState('''');", :id => ''country_id''}) %>It''s the usual "the first hash is options, the second is for html options" thingy.> > > help............... > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---