I\'m trying to use the automatic binding feature of Play, without success. I\'m developing in Java, on Eclipse 4.4 Luna.
Here is my form :
In your code you have :
Users u = Form.form(Users.class).bindFromRequest().get();
Try with this instead :
Users user = new Users();
Form u = Form.form(Users.class).fill(user).bindFromRequest();
EDIT :
May be the problem is the input types you're using. Try to generate your form like this :
@form(routes.Backend.createUser()) {
@inputText(userForm("first_name"))
@inputText(userForm("first_name"))
@inputText(userForm("email"))
@inputText(userForm("pin"))
@inputText(userForm("status"))
@checkbox(userForm("is_guest"))
}
Then in User Entity
: try to change all columns type to String
@Entity
public class Users extends Model {
// Database columns
@Id
public int user_id;
public String first_name;
public String last_name;
public String email;
public String pin;
public String status;
public String is_guest;
}
In your controller :
public class Backend extends Controller {
public static Result createUser() {
Form userForm = Form.form(Users.class).bindFromRequest();
Users user = userForm .get();
user.save();
}
}