Meu modelo não está obrigando o preenchimento de campos no meu html. Alguém ve o que ha?
@(form: DynamicForm)
@import b3.vertical.fieldConstructor
@main("Welcome to Play") {
<!-- cadastro de usuario -->
@b3.form(routes.MainController.addNewUser){
<h1>Cadastrar novo usuario</h1>
@b3.text(form("name"), '_label -> "nome")
@b3.email(form("email") , '_label -> "Email")
@b3.password(form("password") , '_label -> "Senha")
@b3.submit('class -> "btn btn-primary"){cadastrar}
}
}
package models;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import com.avaje.ebean.Model;
import play.data.validation.Constraints.Required;
@Entity
public class User extends Model{
@Id @GeneratedValue
private int id;
@Required (message = "campo obrigatorio")
private String name;
@Required (message = "campo obrigatorio")
private String email;
@Required (message = "campo obrigatorio")
private String password;
public int getId() {
return this.id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "User [name=" + name + ", email=" + email + ", password=" + password + "]";
}
}