I’m really a starter with Scala, so pardon me if I’m stupid here!
I’m using play2.0/Scala for an assignment.
I want to populate a dropdown with distinct values(timesheetId here) and labels(a concat of 2 date values). So I did this.
@select(effortForm("timesheetId"),options(timesheets.map(aTimesheet=> aTimesheet.timesheetId.toString -> (aTimesheet.fromDate + " to " + aTimesheet.toDate))),'_label->"Choose Timesheet (*)")
But the page has a dropdown populated with same value (as a tuple) and label for options under select.
Overloaded method value [apply] cannot be applied to (List[(java.lang.String, java.lang.String)])
I want to see this as result
<option value="1">Sun Apr 08 18:23:32 PDT 2012 to Sun Apr 08 18:23:32 PDT 2012</option>
Please help!
Try this:
Looking at the implementation of select, it looks like the second parameter should be a
Seq[(String, String)]which would already be the case for yourtimesheets.map{ }.options(...)provides conveniences methods to constructs theSeq[(String, String)]and there is not a method that applies here.