I am new to Scala and the Play Framework. My goal is to display a checkbox in a view with values from a model. I would also like to grab those checkbox values from the view, process in a controller (make sure at least one value is selected), and add to a record in a model.
I have my controller built which displays the view and passes the checkbox values:
public Result addProfile() {
List<Service> services = Service.find.all();
return ok(profile.render(form(ProfileRegister.class), services));
}
I have my view built:
@(profileForm: Form[Application.ProfileRegister], servicesList: java.util.List[Service])
@main(null) {
@for(service <- servicesList) {
<input type='checkbox' name='servicesThis' value=@service>@service <br>
}
}
However, when the view displays, it looks like this:
I would like to have a checkbox appear -- it just displays text with no box to check. I wanted to also show the value of each record, such as the name property/field.
I would appreciate any help on this.
Thanks!
Aucun commentaire:
Enregistrer un commentaire