In my view, I'm creating a radio buttons, with the values 0,1,2 (string).
inputRadioGroup(
dayForm("time"),
options("0"->"Morning","1"->"Afternoon","2"->"Night"))
In my model the I'm using time as a integer value, and radiobox does not have the option to submit the input as an integer.
So in my controller I though of converting the time input into a integer and checking if the value is between 0-2.
val dayForm = Form(
mapping(
"id" -> optional(longNumber),
"time" -> <what can I do here to avoid type mismatch?>,
"date" -> sqlDate("yyyy-MM-dd") (Entry.apply)(Entry.unapply)
Is there a way to convert the time into a int and THEN verify if its a number between 0-2? Like this:
"time" -> number (min =0, max =2)
That one will result in the form not validating as the input string hasn't been converted.