FormField
object FormFieldConstructors for typed FormField definitions.
Defined by scalive.FormField. View source (scalive/api/src/scalive/forms/FormField.scala:85-148)
Methods5
apply
def apply[A](path: FormPath)(decode: Vector[String] => Either[FormErrors, A]): FormField[A]Creates a field decoder over every raw value submitted under path.
The vector is in encounter order and is empty when the name is absent. The supplied function owns all cardinality and validation semantics.
Defined by scalive.FormField.apply. View source (scalive/api/src/scalive/forms/FormField.scala:91-96)
optionalString
def optionalString(path: FormPath, duplicateMessage: String = ...): FormField[Option[String]]Creates an optional scalar string field that rejects duplicates.
Missing and singly submitted empty values decode as None; one non-empty value becomes
Some(value); multiple values produce one error at path.
Defined by scalive.FormField.optionalString. View source (scalive/api/src/scalive/forms/FormField.scala:132-140)
requiredString
def requiredString(path: FormPath, blankMessage: String = ..., duplicateMessage: String = ...): FormField[String]Creates a scalar string field requiring exactly one non-empty value.
Missing and singly submitted empty values use blankMessage. Multiple values fail first with
duplicateMessage. Values are not trimmed.
Defined by scalive.FormField.requiredString. View source (scalive/api/src/scalive/forms/FormField.scala:120-125)
string
def string(path: FormPath, duplicateMessage: String = ...): FormField[String]Creates a scalar string field that rejects duplicates.
A missing field decodes as ""; exactly one value is returned unchanged, including an empty
value; two or more values produce one error at path. This intentionally differs from
requiredString and optionalString, which select the last
duplicate.
Defined by scalive.FormField.string. View source (scalive/api/src/scalive/forms/FormField.scala:105-113)
strings
def strings(path: FormPath): FormField[Vector[String]]Creates a field that always succeeds with all submitted values in encounter order.
Defined by scalive.FormField.strings. View source (scalive/api/src/scalive/forms/FormField.scala:143-144)