how do I know checkbox if a checkbox is checked after F5?

Good day,

i dont get why u need to do this but you can use session to store
newly checked checkboxes even if user not pressed Submit.

just make onclick event for each checkbox(javascript), that insert to
session coookie id of checkbox.

<input type="checkbox" onclick="doRemember(this.id)" />

function doRemember(domID)
{
    PUT small verification code to determine wheither checkbox are
checked or not
if checked call Set_Cookie("checkbox_" + domID, 1);
if unchecked call Set_Cookie("checkbox_" + domID, 0);
}

function Set_Cookie(name,value)
{

    var cookieString = name + "=" +escape(value);
    document.cookie = cookieString;
}
<--------------------->

okay, now when u reload page and running in loop of some model just
check session cookie with "checkbox_?" names,
split it by "_" and if somemodel.id = ? (of checkbox, and checkbox_? =
1) then html attribute of this will be checked="checked"

Make something that will make hash of all cookie checkboxes like:
checkboxes ... [id, value] [id, value]
values will be 0 or 1
and id will be value after checkbox_?

Offcourse you should run another loop inside instance loop, to check
all checkbox_? cookies.
box.each do | box |
  attrib = ""
  checkboxes.each do | checkbox |
     attrib = "checked="
     if checkbox.id == box.id
         checkbox.value == 1 ? attrib += "'checked'" : attrib +=
"'none'"
      end
  end
end