目前,我有一个简单的表单Form[(String, String, String)]
在我的scala.html文件中:
@form(routes.Application.editParticipant(pid)) {
@inputText(pForm("email"),'_label -> "Email", '_showConstraints -> false, 'placeholder -> email)
@inputText(pForm("password"),'_label -> "Password", '_showConstraints -> false, 'placeholder -> password)
@inputText(pForm("phone"),'_label -> "Phone number", '_showConstraints -> false, 'placeholder -> phone)
<input type="submit" value="edit">
}
如果用户没有编辑,我希望表单提交电子邮件,密码,手机的当前值。我该怎么做?
答案 0 :(得分:2)
您可以传递默认值,如
@inputText(pForm("email").copy(value=Some("abc@def.com")),'_label -> "Email", '_showConstraints -> false, 'placeholder -> email)