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

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -