양식에 문제가 있습니다.보기에 오류가 제대로 표시되지 않을 수 있습니다. 유효성 검사가 정상적으로 작동합니다.프레임 워크 2.0 스칼라 양식 오류 처리
암호가 일치하지 않을 때 이전 암호가 틀렸을 때 입력란 아래에 오류 메시지가 표시되는데, 암호가 일치하지 않으면 오류가 어디에도 나타나지 않습니다. 보기에서
: 나는 몇 가지 디버깅을 할 경우
내가 데이터를 얻을 수 @pass_form("password").errors
내가이 얻을 :
FormError(password,Passwords dont match,WrappedArray())
어떻게보기에서 폼 또는 코드를 수정하는 내 질문에, 그 오류를 올바르게 인쇄하십시오. 보기에서
Form(
mapping(
"old_password" -> text.verifying(Messages("forms.password.old.mismatch"),
password => User.correct_?(user.id, password)),
"password" -> tuple(
"new" -> text(minLength = conf.getInt("password.length.min").get),
"confirm" -> text).verifying(Messages("forms.password.new.mismatch"),
passwords => passwords._1 == passwords._2)
)
((_, password) => password._1)((_) => Some(("", ("", ""))))
)
나는이 :
당신이 그들에 대해 하나 있기 때문에, 암호 필드의 도우미 방법을 사용할 수 있습니다 모든@helper.form(action = routes.UserController.submitPassword) {
@helper.input(pass_form("old_password")) { (id, name, value, args) =>
<input type="password" name="@name" id="@id" @toHtmlArgs(args)>
}
@helper.input(pass_form("password.new")) { (id, name, value, args) =>
<input type="password" name="@name" id="@id" @toHtmlArgs(args)>
}
@helper.input(pass_form("password.confirm")) { (id, name, value, args) =>
<input type="password" name="@name" id="@id" @toHtmlArgs(args)>
}
<input type="submit" value="Set">
}
... 적절한 방법으로 다음을 표시 할 수 있지만, 당신은 어떻게 당신의 형태로'user.id'을받을 수 있나요? –
나는 https://github.com/t2v/play20-auth의 모듈을 사용하며 authorizedAction이라는 메서드가 있으며 사용자에게 제공됩니다. – mapek
감사합니다. –