Dao Lam
Dao Lam

Reputation: 2937

Play 2.2 Scala: Default values for a simple form

Currently, I have a simple form that is Form[(String, String, String)]

In my scala.html file:

    @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">
}

I want the form to submit the current values of email,password,phone if the user doesn't edit it. How do I do that?

Upvotes: 1

Views: 625

Answers (1)

S.Karthik
S.Karthik

Reputation: 1389

You could pass default value like

 @inputText(pForm("email").copy(value=Some("[email protected]")),'_label -> "Email", '_showConstraints -> false, 'placeholder -> email)

Upvotes: 2

Related Questions