Dear All,
Anybody knows to keep the selected option as alive even after “submit”
in
collection_select.
–
With Regards
Palani Kannan. K
Dear All,
Anybody knows to keep the selected option as alive even after “submit”
in
collection_select.
–
With Regards
Palani Kannan. K
On 5 October 2010 11:14, PalaniKannan K [email protected] wrote:
Dear All,
Anybody knows to keep the selected option as alive even after “submit” in
collection_select.
Hi,
I found the method. If I use like this I can keep as live.
<%= collection_select(@table, “gm”, @pop, “col1”, “col1”, :prompt =>
true, :selected
=> params[:gm]) %>
The bold marked content, I inserted to my script and the selected value
remains.
–
With Regards
Palani Kannan. K
–
With Regards
Palani Kannan. K
On 5 October 2010 14:06, PalaniKannan K [email protected] wrote:
I found the method. If I use like this I can keep as live.
<%= collection_select(@table, “gm”, @pop, “col1”, “col1”, :prompt => true,
:selected => params[:gm]) %>The bold marked content, I inserted to my script and the selected value
remains.
I think it is not considered good practice to directly reference
params in the view, as that means that the view is directly dependent
on the way the controller action was called. It might be better in
the controller action to say
@selected_item = params[:gm]
and then in the view use :selected = @selected_item.
It amounts to the same thing but achieves better separation of the
different bits of code.
Colin
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs