I have a problem with the forms in play2.
Model:
@Id private ObjectId id;
Form
<input name="id" id="id" type="hidden" value="@guidesForm.field("id").value()">
I can not initialize the id field with bindFromRequest()
it will always be empty. And I can only query with an ObjectId not with a string.
ObjectId id = new ObjectId(form().bindFromRequest().get("id"));
This is the correct constructor for an objectid. As you can see this is my workaround I don't use guideForm.bindFromRequest();
I just have to bind it directly.
This feels a bit hacky. Is a soltuion where i just can use the normal binding?
Form<Myclass> guideForm = form(Myclass.class);
Form<Myclass> filledForm = guideForm.bindFromRequest();