How to add validation in play form?
Below is reset password form which expects user to enter password twice.
@(tokenId: String, form: Form[ResetPassword])(implicit messages: play.api.i18n.Messages, request: RequestHeader)
@main("Reset Password") {
@helper.form(routes.Application.handleResetPassword(tokenId)) {
@helper.inputText(form("password1"))
@helper.inputText(form("password2"))
<button type="submit">Submit</button>
}
}
In above form, I would like to add validation that will check if password1 and password2 are same or not.
Thanks Pari
You could do:
This is just untested pseudo code, check out the docs for that purpose