Advanced Minds

  • Decrease font size
  • Default font size
  • Increase font size
  • default color
  • red color
  • green color
FireBoard
Welcome, Guest
Please Login or Register.    Lost Password?
rails multi select drop down maintaining drop down menu selections (1 viewing) (1) Guests
Go to bottom Post Reply Favoured: 0
TOPIC: rails multi select drop down maintaining drop down menu selections
#5808
rushnosh (Visitor)
Click here to see the profile of this user
Birthdate:
rails multi select drop down maintaining drop down menu selections  
i am creating multiple drop down menus using <%= form.select(:choice, @list.map { | item | [ item[0], item[1] ] }) % this works great but when the client hits submit and there are other validation errors it resets the drop down menu. how do i maintain the selected item. my search for the options of the slect method has come up empty. @list is created in the controller and used in the view. can you not test :choice to see if the user has choose an item and then display the drop down with the correct item selected. thanks.
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#5809
rails multi select drop down maintaining drop down menu selections  
sorry, don't have the time to go into details right now, but maybe that'll help you a bit: <%= select_tag client[branch][] ,     options_for_select([['Automatisering','1'],                         ['Bouwnijverheid', '2'],                         ['Communicatie Intern', '3'], ['Communicatie Extern', '4'], ['Cultuur', '5'],                         ['Detailhandel food', '6'], ['Detailhandel non food', '7'], ['Drukkerij', '8'],                         ['Facilitaire dienst', '9'], ['Financiele dienstverlener', '10'],                         ['Gezondheidszorg', '11'],                         ['Handel', '12'],                         ['Industrie', '13'], ['IT', '14'],                         ['Mediabureau', '15'],                         ['Overheid', '16'], ['Onderwijs', '17'], ['Onderzoek', '18'],                         ['Reclamebureau', '19'], ['Recreatie & toerisme', '20'],                         ['Telecom', '21'], ['Transport sector', '22'],                         ['Uitgeverij dag-en weekbladen', '23'], ['Uitgeverij publieksbladen', '24'], ['Uitgeverij vakbladen', '25'],                         ['Uitgeverij relatiemagazines', '26'],                         ['Zakelijk adviesbureau', '27'], ['Overig', '28']], @client.branch), :multiple = true, ize = 7, :id = client_branch % in this case @client.branch holds an array of ids that are selected, but could be a single element too http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelp... options_from_collection_for_select may be another alternative and the choices parameter of form.select works just the same as options_for_select
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#5810
rushnosh (Visitor)
Click here to see the profile of this user
Birthdate:
rails multi select drop down maintaining drop down menu selections  
sorry, don't have the time to go into details right now, but maybe that'll help you a bit: <%= select_tag client[branch][] ,     options_for_select([['Automatisering','1'],                         ['Bouwnijverheid', '2'],                         ['Communicatie Intern', '3'], ['Communicatie Extern', '4'], ['Cultuur', '5'],                         ['Detailhandel food', '6'], ['Detailhandel non food', '7'], ['Drukkerij', '8'],                         ['Facilitaire dienst', '9'], ['Financiele dienstverlener', '10'],                         ['Gezondheidszorg', '11'],                         ['Handel', '12'],                         ['Industrie', '13'], ['IT', '14'],                         ['Mediabureau', '15'],                         ['Overheid', '16'], ['Onderwijs', '17'], ['Onderzoek', '18'],                         ['Reclamebureau', '19'], ['Recreatie & toerisme', '20'],                         ['Telecom', '21'], ['Transport sector', '22'],                         ['Uitgeverij dag-en weekbladen', '23'], ['Uitgeverij publieksbladen', '24'], ['Uitgeverij vakbladen', '25'],                         ['Uitgeverij relatiemagazines', '26'],                         ['Zakelijk adviesbureau', '27'], ['Overig', '28']], @client.branch), :multiple = true, ize = 7, :id = client_branch % in this case @client.branch holds an array of ids that are selected, but could be a single element too http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelp... options_from_collection_for_select may be another alternative and the choices parameter of form.select works just the same as options_for_select
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
#5811
rushnosh (Visitor)
Click here to see the profile of this user
Birthdate:
rails multi select drop down maintaining drop down menu selections  
On Apr 23, 11:30 am, Thorsten Mueller <rails-mailing-l...@andreas- s.net wrote: sorry, don't have the time to go into details right now, but maybe that'll help you a bit: <%= select_tag client[branch][] ,     options_for_select([['Automatisering','1'],                         ['Bouwnijverheid', '2'],                         ['Communicatie Intern', '3'], ['Communicatie Extern', '4'], ['Cultuur', '5'],                         ['Detailhandel food', '6'], ['Detailhandel non food', '7'], ['Drukkerij', '8'],                         ['Facilitaire dienst', '9'], ['Financiele dienstverlener', '10'],                         ['Gezondheidszorg', '11'],                         ['Handel', '12'],                         ['Industrie', '13'], ['IT', '14'],                         ['Mediabureau', '15'],                         ['Overheid', '16'], ['Onderwijs', '17'], ['Onderzoek', '18'],                         ['Reclamebureau', '19'], ['Recreatie & toerisme', '20'],                         ['Telecom', '21'], ['Transport sector', '22'],                         ['Uitgeverij dag-en weekbladen', '23'], ['Uitgeverij publieksbladen', '24'], ['Uitgeverij vakbladen', '25'],                         ['Uitgeverij relatiemagazines', '26'],                         ['Zakelijk adviesbureau', '27'], ['Overig', '28']], @client.branch), :multiple = true, ize = 7, :id = client_branch % in this case @client.branch holds an array of ids that are selected, but could be a single element too http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelp... options_from_collection_for_select may be another alternative and the choices parameter of form.select works just the same as options_for_select
 
Report to moderator   Logged Logged  
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop
905 wymiana linkow sprawdz autoryzacje authorization failed nieautoryzowano
diving college signs of pregnancy diving company online pharmacy tax rebate