inputRadioGroup في اللعب 2.2
-
20-12-2019 - |
سؤال
واجهت خطأ أثناء ترجمة هذه التعليمة البرمجية:
@(newStaff: List[staffInfo], newStaffForm: Form[staffInfo])
@import helper._
@main("Simple application") {
@form(routes.Application.newForm()) {
@inputText(newStaffForm("name"))
@inputRadioGroup(
newStaffForm("gender"),
options = Seq("M"->"Male","F"->"Female")
'_label -> "Gender",
'_error -> newStaffForm("gender").error.map(_.withMessage("select gender")))
@inputDate(field = newStaffForm("dateOfBirth"), args = 'size -> 10)
<input type="submit" value="Submit">
}
}
تجميع رسالة الخطأ : ')' كان متوقعا ولكن الرمز الحرفي وجدت. الخطأ هو تسليط الضوء هنا -- > '_label
أحد يعرف كيفية حل هذه المشكلة ؟
المحلول
يبدو أنك تفتقر فقط فاصلة بعد هذا السطر:
options = Seq("M"->"Male","F"->"Female")
ينبغي أن يكون
options = Seq("M"->"Male","F"->"Female"), //note the comma in the end
لا تنتمي إلى StackOverflow