Robbie:
I am assuming that you just want to send back the items which are checked...
If so, try this:
<input name="print[]" value="<%= staffmember.id %>"
type="checkbox" />
When the form posts you will have access to the checked values in
@params[''print''] which should be an array.
Then the Staffmember.find(@params[''print'']) should work
fine...
At least the above worked when I did it for something very similar...
aw
p.s. if it doesn''t work, I''m still pretty new to this as well
;)
On 6/14/05, Robbie Shepherd
<robbie.shepherd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Can anybody point me in the right direction here please?
>
> I have a form with a series of checkboxes like so:
>
> <form action="staffmember/print" method="post>
> Name: <%= staffmember.name %> <input id="print[<%=
staffmember.id %>]"
> name="print[<%= staffmember.id %>]"
type="checkbox" value="" /><br />
> </form>
>
> in my staffmember.rb controller, I would like to do something that gets
all
> of the print[] array items in the posted form and use those id''s
to do a
> select with, but I can''t get it to work - I thought the following
should
> work but it doesnt:
> @print = @params[:print]
> @staffmembers = Staffmember.find(@params[:print])
>
> I also tried using the rails <% check_box ...%> in the form but it
also
> outputted a hidden field with the same names and id''s as the
cehckboxes,
> which didnt see right
>
> any clues please?
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>