I have a form that contains several lines, each of which has a checkbox in the sheet. The user can select some of them, and then click the "delete selected lines" button to send.
Published data is as follows:
id=1&id=2&id=3
I want to get them in action, my code is:
def delete = Action { implicit request => Form("id"->seq(nonEmptyText)).bindFromRequest.fold( errors => BadRequest, ids => { println(ids) // (!) for(id<-ids) deleteRow(id) } ) }
But I found that identifiers are always List() , an empty list.
I checked the "Sample Forms" provided by play2 and found that seq(...) should only work with published data with this format:
company sdfdsf firstname sdfds informations[0].email sdf@sdf.com informations[0].label wef informations[0].phones[0] 234234 informations[0].phones[1] 234234 informations[0].phones[x] informations[1].email sdf@sdf.com informations[1].label wefwef informations[1].phones[0] 234234 informations[1].phones[x] informations[x].email informations[x].label informations[x].phones[x]
Note that there are many [0] or other indexes in the parameter names.
source share