在input属性中添加onclick事件:onclick="this.value=this.checked?1:0"
举例:
<input type="checkbox" name="hasPopupMsg1" #if($!hasPopupMsg1 == 1)checked="checked" #end onclick="this.value=this.checked?1:0">
onclick="this.value=this.checked?1:0"
测试结果: