I need a form visualization with validators for this model:
Model:
case class Service ( name: String, description: String, unitcost: Long, typo: Char, isactive: Char, modifiedby: String)
Controller:
import play.api.data.Form import play.api.data._ import play.api.data.format.Formats._ import play.api.data.Forms._ object Services extends Controller { .... .... private val servicesForm[Service] = Form( mapping( "name" -> nonEmptyText.verifying( "validation.name.duplicate", Service.findByName(_).isEmpty), "description" -> nonEmptyText, "unitcost" -> longNumber, "typo" -> of[Char], "isactive" -> of[Char], "modifiedby" -> nonEmptyText ) (Service.apply)(Service.unapply) )
This code does not work on each of [Char], saying that its necessary import is play.api.data.format.Formats._ but I was ..
My second doubt is how to put a couple of radio buttons for each (typo and inactive) thinking that typos have "M" and "A", such as options and inactive, have "Y" and "N".
PD: I think put it using the save model after ...
source share