Check_box_tag with instance variable

hi,

i am trying to use one check_box with instance variable and trying to
get true or false value from database table.

and also please give me solution for multiple check_box and select all

how to feed and retrieve value and show in check box.

Thanks
Purab

Something like this for your first two questions?
<% POSSIBLE_CATEGORIES.each do |web|%>
<% if option_checked(web) %>
<%= check_box_tag web, ‘1’, true%><%= web %><% else %>
<%= check_box_tag web %><%= web %><% end%>
<% end %>

Where POSSIBLE_CATEGORIES is an array of what you want the check boxes
to represent, ‘1’ is the value of a checked check box, and true defaults
it to checked.

option_checked(web) is a method in ApplicationHelper that compares the
name of the check box (gotten from POSSIBLE_CATEGORIES) to something
stored in the database. You could easily modify it for the true/false
that you want.

Sorry if I misunderstand/this doesn’t solve your problem (and there’s
probably a better way to do this, but this works for me).

On Wed, Jun 18, 2008 at 4:12 PM, Purab K.
[email protected] wrote:

i am trying to use one check_box with instance variable and trying to
get true or false value from database table.

and also please give me solution for multiple check_box and select all

how to feed and retrieve value and show in check box.

Have a look at the check_box helper.