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

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 K. 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