views:

32

answers:

1

I have some checkboxes like so in a form:

<%= check_box_tag "marked[#{relative_filepath}]", 1, false %>

Which produces:

<input type="checkbox" value="1" style="display: none;" name="marked[/blah]" id="marked__blah">

Now supposedly, I should there should be a hash in params[:marked], but this is nil.

What am I doing wrong?

+1  A: 

From railsapi.com:

"The HTML specification says unchecked check boxes are not successful, and thus web browsers do not send them."

I usually use something like params[:object][:method].to_bool.

j.
Right now the checkboxes are checked via javascript, but even if I remove the *style="display:none;"* and visibly check them and then post the form, params[:marked] is still nil.
rhardih
What parameters are being sent? What do you get with `params.inspect`?
j.
This even though I've checked off some boxes:`{"authenticity_token"=>"+a7L3q+LMRgEWungZm6TvFkpXuOpsl7jdi+gWu0SFxw=", "_method"=>"delete", "action"=>"delete_folder", "controller"=>"browser"}`
rhardih