Answering to myself...
I created a custom tag and it's a bit simplier.
I also implemented the case where the validation failed, the page is
reloaded and we need to select the previous value.
In the main page I declared my tag as shown below :
<select name="dobDay" id="jourNaissance">
@generateOption(31,flash.get("dobDay"))
</select>
In the generateOption.scala.html I wrote this :
@(rangeParam:Int,currentValue:String)
@((1 to rangeParam toList).map{e=>
if(currentValue!=null && e.equals(Integer.parseInt(currentValue)))
{
format.raw("<option selected value='"+e+"'>" + e +"</option>")
} else {
format.raw("<option value='"+e+"'>" + e +"</option>")
}
}
)
Hope it will also help someone with Scala, html select, option and
selected
Nicolas Martignole