Using a LiftScreen Field or Text

I use the dash LiftScreenand I doubt the field and text methods. The text method uses the method makeFieldand then SHtml.textto render the field, while the method fielduses the trait FormVendorto render html.

So what is the best way to add a field? Did I have to use the field method or text / password / etc methods?

Thank.

+5
source share
1 answer

The field method is a bit of syntactic sugar for creating fields using field generators. It uses the default values ​​from this generator to create the field.

The makeField method allows you to get the exact specifications of your field.

, " ". , FormVendor, . , makeField.

makeField . , makeField("Password", "", SHtml.password(is, set _))

object MyScreen extends LiftScreen { 
  val password = new Field { 
    type ValueType = String 
    override def name = "Password" 
    override implicit def manifest = buildIt[String] 
    override def default = "" 
    override def toForm: Box[NodeSeq] = SHtml.password(is, set _) 
  } 
} 

( LiftScreen)

. -, "", Lift Wiki : " → LiftRules.vendForm . , , .

+6

All Articles