Class/Object

com.hacklanta.formality

FormalityFormProto

Related Docs: object FormalityFormProto | package formality

Permalink

case class FormalityFormProto[FieldList <: HList, FieldBoxList <: HList, HeadFieldValueType, RestFieldValueTypes <: HList] extends Product with Serializable

FormalityFormProto is the starting point for creating a formality form. It uses a lot of type magic, so that is going to be detailed here. At its most basic, however, it simply tracks a type-preserving list of FieldHolderBases and provides a single function, withField, to add a new such field to the form.

Once you've added all the fields you want, call formalize. This returns a FormalityForm, on which you can set success/failure/submission handlers, and which provides the facility to convert the form down to a single CssSel instance that will properly set up the form and all of its fields.

Typing discussion ---------------

shapeless lets us track our list of fields that can be String fields, Int fields, DateMidnight fields, or any other arbitrary type, while preserving those types and their order. As we build this list up, we call withField and add fields to the list one by one.

Because of what we need to do once we convert to a FormalityForm.

Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. FormalityFormProto
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. macro def ajaxFormalize: AjaxFormalityForm[FieldList, FieldBoxList, :+:[HeadFieldValueType, RestFieldValueTypes], _, _]

    Permalink
  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. val bindFields: CssSel

    Permalink
  7. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  8. val computeValues: () ⇒ (FieldBoxList, CombinableBox[HeadFieldValueType, RestFieldValueTypes])

    Permalink
  9. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  10. val fields: FieldList

    Permalink
  11. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. macro def formalize: StandardFormalityForm[FieldList, FieldBoxList, :+:[HeadFieldValueType, RestFieldValueTypes], _, _]

    Permalink
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  19. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  20. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. macro def withAjaxFields(fields: FieldHolderBase[_]*): FormalityForm[_, _, _, _, _, _]

    Permalink
  23. def withField[FieldValueType](field: FieldHolderBase[FieldValueType]): FormalityFormProto[:+:[FieldHolderBase[FieldValueType], FieldList], :+:[Box[FieldValueType], FieldBoxList], FieldValueType, :+:[HeadFieldValueType, RestFieldValueTypes]]

    Permalink

    Adds the specified field to the front of this form.

    Adds the specified field to the front of this form.

    This means that calling myForm.withField(field1).withField(field2) will give you those fields in reverse order in your submission handlers (field2's value first, then field1's). It's recommended that you instead use the withFields or withAjaxFields helpers, which let you add a group of fields * all at once in proper order and leaves you with a form that can accept submission handlers.

    returns

    A new FormailtyFormProto with the given field prepended to its list of fields. Note that you still need to call formalize or ajaxFormalize on that form if you want to attach submission handlers.

  24. macro def withFields(fields: FieldHolderBase[_]*): FormalityForm[_, _, _, _, _, _]

    Permalink

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped