playframework - Display Form Validation Error Using mkString() -
i trying display error messages view using in built mkstring method call on form. result not expected:
i have:
@productform("name").errors().mkstring(", ") and view renders following:
validationerror(name,error.required,[]) how can display exact message?
i using play 2.1.1 (it java project)
thanks
@productform("name").errors() returns collection of validationerror objects. want run mkstring on collection of validation error messages, need first map validationerror collection of collection of strings:
@productform("name").errors().map(n => n.message).mkstring(",") i think return error.required, still not quite want. when map you'll want map messages api lookup:
@productform("name").errors().map(n => messages(n.message)).mkstring(",")
Comments
Post a Comment