hi i have some problem with play framework forms
public class User extends Model{
public String firstName;
@Required
public String lastName;
@Required
public String password;
@Required
public boolean bedAccess;
}
and i create a form in my template using Form helper
@form(routes.Application.createUser()) {
<table border="1" class="inserTable">
<tbody>
<tr>
<td>@inputText(userForm("firstName"))</td>
<td>@inputText(userForm("lastName"))</td>
<td>@inputPassword(userForm("password"))</td>
<td>@checkbox(userForm("bedAcces"))</td>
<td><input type="submit" value="Create"> <td/>
</tr>
<tbody/>
<br/>
when i see the result my labels are printed the same as my User models fields like firstName but i want to have custom labels like "users first name" for my firstName field and "user last name" for my lastName field of my model what should i do?
and how ?
any body can help?
Pass the label parameter like:
@inputText(objForm("firstName"), '_label -> "You label")
use can use @helper class for the initialize the view and pass the parameter like:
@(contacts: List[models.Contact])
@helper.form(action = routes.Contacts.create) {
@helper.inputText(form("name"), '_label -> "Name")
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With