Incorporate fields from MegaProtoUser into a wizard screen

I'm just starting out with scala and lift and am a bit stuck regarding incorporating form fields from MegaProtoUser into a wizard screen.

I have the following MegaProtoUser code:

object User extends User 
  with MongoMetaRecord[User]
  with MetaMegaProtoUser[User] {
    override def skipEmailValidation = true
  }

class User private () extends MongoRecord[User]
  with MegaProtoUser[User] {
    def meta = User

     //protected methods ...

}

And my wizard setup looks like the following:

object SignupWizard extends Wizard {
  object completeInfo extends WizardVar(false)

  val person = new Screen {

    //Incoroporate MegaProtoUser fields here ...

    override def nextScreen = {
       business
    }
  }

  val business = new Screen {
    val business = field("Business name","")
  }

  def finish() {
    S.notice("Thank you for registering!")
    completeInfo.set(true)
  }

}

I want to incorporate some selected (not all) fields from my MegaProtoUser class into the person screen but do not now how to do this with the methods available to both. Any help is much appreciated.

Answers


AbstractScreen's addFields method can add individual fields, as well as adding all the fields from a Record object. This works on both LiftScreen and Wizard's Screen.

// assuming you just want to create a new user
object user extends WizardVar(User.createRecord)

val person = new Screen {
  // addFields(() => user.is) would add all fields
  addFields(() => user.is.email)
  addFields(() => user.is.password)
  addFields(() => user.is.timezone)

  override def nextScreen = {
     business
  }
}

Need Your Help

rails 4 many to many form saving and update

ruby-on-rails forms many-to-many

I have many-to-many relationship and I want to use checkboxes to select relationships that I need.

Parsing JSON returned from the Sitecore Item Web API

c# json sitecore deserialization asp.net-web-api

I am having trouble parsing the following JSON object from the Sitecore API: