Kad Kerforn
2006-Sep-26 15:54 UTC
helper SELECT :include_label... rather than :include_blank
3 related questions about it : 1/ Is there any way to replace the blank by a pre-defined label like ''All of them'' ? 2/ once an option has been selected, is there any way to reinitialize the selection back the blank(or All...) label ? 3/ or should I build myself a specific option for that purpose ? kad -- 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 -~----------~----~----~----~------~----~------~--~---
Cayce Balara
2006-Sep-26 16:47 UTC
Re: helper SELECT :include_label... rather than :include_bl
1/ use :prompt => "Your Prompt" in the options hash of your select() helper call and the first option in the list will be whatever you set :prompt to, with a value of "" (remember to code your controller to test for and respond appropriately to submissions where nothing was selected). For instance: select(''controller'',''action'',[["Option 1",1],["Option 2",2]], {:prompt => "Select Option"}) 2/ if you are talking doing this in response to an action the user takes on that page, then you would use javascript to set the value of the DOM element to "". if you are instead talking about how to reset it after the user has submitted the page and it comes back, then you would do that in your controller by setting the appropriate model attribute value to "". 3/ I think RAILS has it for you, no need for this. c. Kad Kerforn wrote:> 3 related questions about it : > > 1/ Is there any way to replace the blank by a pre-defined label like > ''All of them'' ? > 2/ once an option has been selected, is there any way to reinitialize > the selection back the blank(or All...) label ? > > 3/ or should I build myself a specific option for that purpose ? > > kad-- 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 -~----------~----~----~----~------~----~------~--~---