Form validation play framework 2.0

霸气de小男生 提交于 2019-12-03 13:37:48

This is expected behavior.

Note that you must use .get() on form After check for errors.

LoginForm preLoginForm = loginForm.bind(anyData);

if(loginForm.hasErrors()) {
    //Just for this test task, should have another error handling..
    return ok("@Required annotation kicked in..");
}
LoginForm postedLoginForm = preLoginForm.get();
// ... Now use postedLoginForm 

This seems to be a bug with Play 2.0 framework. I was able to replicate the same problem locally.

I opened a ticket https://play.lighthouseapp.com/projects/82401-play-20/tickets/313 in case you want to follow up.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!