I have a input of date type. The attribute is like this:
@Formats.DateTime(pattern="dd/MM/yyyy")
public Date prazo;
In the *.scala.html
file, I tried this:
@helper.input(pedidoForm("prazo"), '_label -> "Prazo", '_help -> "") { (id, name, value, args) =>
<input type="date" name="@name" id="@id" maxlength="14" @toHtmlArgs(args)>
}
and
@inputDate(pedidoForm("prazo"), '_label -> "Prazo", '_help -> "")
It compiles and seems to work fine, but in the controller I have something like:
Form<Pedido> pedidoForm = form(Pedido.class).bindFromRequest();
...
pedidoForm.get(); // throws execution exception
Does anyone have an idea of what can be happening??
Thanks for the attention.
I think you have entered wrong format for date input.
Form what I have tried. If you entered
22/03/1989
as value of input, there is no runtime exception. But if you entered22 03 1989
, the exception is occurred. I think it is because you define theprazo
field asdd/MM/yyyy
date format.So let's we look again. If you define the
prazo
field asdd MM yyyy
date format, and you entered value22 03 1989
as value of input, there is no runtime exception. In addition, there something that interested me, if you entered22/03/1989
there is no runtime exception too. But, with the date you entered previously, it cannot be parsed correctly.In this stage, I think the framework accept value like
dd/MM/yyyy
as aDate
object. But if you want other date format displayed or entered the@Formats.DateTime(pattern="dd MM yyyy")
annotation should be used.