Using PlayFramework 2.0.1, I have a model :
class MyModel extends Model {
@Constraints.Required
public String someProperty;
}
class MyController extends Controller {
public static Result action() {
Form<MyModel> form = form(MyModel.class).bindFromRequest();
if (form.hasErrors()) {
// Return errors
}
else {
// Process
}
}
}
Suppose I post with mysite.com/action?some-property=value. How can I match some-property from the request, to someProperty to the model? Is it possible?
Because so far, it hasErrors() fire true since someProperty appears missing.
Don’t add constraints to the model, instead validate and bind it manualy: