I have the html code for check boxes
<input type="checkbox" value="4" name="checked" id="checkbox">
<input type="checkbox" value="5" name="checked" id="checkbox">
<input type="checkbox" value="6" name="checked" id="checkbox">
In Serverside
@RequestMapping(value="/add_attendance", method=RequestMethod.POST)
public ModelAndView Add_Attendance(@Valid @RequestParam("checked")long[]
checkboxvalues,@RequestParam("atdate")String
atdate,@RequestParam("company")String company)
{
ModelAndView mv=new ModelAndView();
atdservice.add(checkboxvalues, ChangeDateFormat.DateToDB(atdate), company);
mv.setViewName("admin/mark_attendance");
mv.addObject("message",company+" attendance marked successfully!!");
return mv;
}
It works fine when at least one check box is checked. But when all the check boxes are unchecked. I got this error
Aucun commentaire:
Enregistrer un commentaire