Checkbox noob question

How do i show only the check items of a checkbox from a list?, so in
show_select page shows only the yes selected checkbox. i have the
agilewebdevelopment rails book but still can’t understand the checkbox
code.

In view i have this
<%= start_form_tag :action => ‘show_select’ %>
<% for request in @requests%>
<%= request.name %>
<%= check_box (‘print’, request.id, {}, “yes”, “no” ) %>
<%end%>
<%= submit_tag ‘Show’ %>
<%= end_form_tag %>

Nic __ wrote:

How do i show only the check items of a checkbox from a list?, so in
show_select page shows only the yes selected checkbox. i have the
agilewebdevelopment rails book but still can’t understand the checkbox
code.

In view i have this
<%= start_form_tag :action => ‘show_select’ %>
<% for request in @requests%>
<%= request.name %>
<%= check_box (‘print’, request.id, {}, “yes”, “no” ) %>
<%end%>
<%= submit_tag ‘Show’ %>
<%= end_form_tag %>

Hi Nic,
So with forms, there are two completely different ways to do them, and
you’ve made a common mistake by mixing the two in the code you’ve
provided. If you start your form with “start_form_tag”, you want to use
calls inside that end with “_tag”, so in your case, you should be using
“check_box_tag” instead of check_box.

Alternatively, you could start the form with “form”, and use check_box.

hth,
jp

Thank you for replying, sorry but i still don’t understand the code to
show name on selected checkbox in show_select page. could you give an
example.

Nic __ wrote:

How do i show only the check items of a checkbox from a list?, so in
show_select page shows only the yes selected checkbox. i have the
agilewebdevelopment rails book but still can’t understand the checkbox
code.

In view i have this
<%= start_form_tag :action => ‘show_select’ %>
<% for request in @requests%>
<%= request.name %>
<%= check_box (‘print’, request.id, {}, “yes”, “no” ) %>
<%end%>
<%= submit_tag ‘Show’ %>
<%= end_form_tag %>

view:

<% for order in @orders %>
<%= check_box_tag ‘orders[]’, order.id.to_s %>
<% end %>

controller:

@orders = Order.find(params[:orders])

Thank you Francis S… That worked.