I''d like to add some filter choices to display a list of items. These items has some boolean fields for example, and would like to have a checkbox at the top of the window to let me select how to filter the list. here''s what i put in my controller if @params[:filter].nil? @params[:filter] = { ''sent'' => "1"} end ... generate the corresponding @items array .. here''s what i did in my view <%= form_tag :action => ''list_items'' %> <%= check_box ''filter'',''sent'' %> <%= submit_tag ''Filter'' %> <%= end_form_tag %> <table> ..... </table> inspecting the @params value, it seems to has a filter[:sent] key, with the correct value (1 if checked) but the check button is always unchecked when the page is generated. Am i so wrong doing this? is there a better way?
Look at Enumerable.grep -- -- Tom Mornini On Feb 16, 2006, at 7:27 PM, Santiago Hirschfeld wrote:> anyone? please > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Thanks, I know i wasn''t clear enough, i''m not a native english speaker. But my problem is not how to filter the list, my problem is with the checkbox being always unchecked and not mantaining the state of selected, don''t know if what i''m doing is right. Thanks anyway. Can someone give me a hint? please? 2006/2/17, Tom Mornini <tmornini@infomania.com>:> Look at Enumerable.grep > > -- > -- Tom Mornini > > > On Feb 16, 2006, at 7:27 PM, Santiago Hirschfeld wrote: > > > anyone? please > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Save the state of the checkbox when submitted in the session and then use the value of the session variable in the tag''s definition to maintain its value. On 2/17/06, Santiago Hirschfeld <jsantiagoh@gmail.com> wrote:> Thanks, I know i wasn''t clear enough, i''m not a native english > speaker. But my problem is not how to filter the list, my problem is > with the checkbox being always unchecked and not mantaining the state > of selected, don''t know if what i''m doing is right. > Thanks anyway. > > Can someone give me a hint? please? > > > 2006/2/17, Tom Mornini <tmornini@infomania.com>: > > Look at Enumerable.grep > > > > -- > > -- Tom Mornini > > > > > > On Feb 16, 2006, at 7:27 PM, Santiago Hirschfeld wrote: > > > > > anyone? please > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >
thanks, that did it 2006/2/17, Ammon Christiansen <ammon.christiansen@gmail.com>:> Save the state of the checkbox when submitted in the session and then > use the value of the session variable in the tag''s definition to > maintain its value. > > On 2/17/06, Santiago Hirschfeld <jsantiagoh@gmail.com> wrote: > > Thanks, I know i wasn''t clear enough, i''m not a native english > > speaker. But my problem is not how to filter the list, my problem is > > with the checkbox being always unchecked and not mantaining the state > > of selected, don''t know if what i''m doing is right. > > Thanks anyway. > > > > Can someone give me a hint? please? > > > > > > 2006/2/17, Tom Mornini <tmornini@infomania.com>: > > > Look at Enumerable.grep > > > > > > -- > > > -- Tom Mornini > > > > > > > > > On Feb 16, 2006, at 7:27 PM, Santiago Hirschfeld wrote: > > > > > > > anyone? please > > > > _______________________________________________ > > > > Rails mailing list > > > > Rails@lists.rubyonrails.org > > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > _______________________________________________ > > > Rails mailing list > > > Rails@lists.rubyonrails.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >