FormState
class FormState[+A](raw: FormData, value: Either[FormErrors, A], used: Set[FormPath], submitted: Boolean)Decoded form data together with validation visibility state.
The four-argument case-class constructor is intentionally low-level: it does not verify that
value was decoded from raw or that used agrees with the payload. The three-argument
The three-argument apply derives used paths from LiveView's _unused_
markers and is the usual constructor for received form data.
Parameters
rawthe ordered form payload used for rendering raw field values
valueeither ordered validation errors or the decoded value
usedexact paths marked used; inspect through isUsed when rendering validation feedback
submittedwhether the state came from a typed
phx-submitbinding; when true, isUsed returns true for every path, including paths absent from used
Type parameters
Athe successfully decoded form value
Defined by scalive.FormState. View source (scalive/api/src/scalive/forms/FormState.scala:31-63)
Methods5
errors
def errors: FormErrorsThe decoding errors, or empty when valid.
Defined by scalive.FormState.errors. View source (scalive/api/src/scalive/forms/FormState.scala:40-40)
errorsFor
def errorsFor(name: String): Vector[FormError]Permissively parses name, then returns matching validation errors in order.
Defined by scalive.FormState.errorsFor. View source (scalive/api/src/scalive/forms/FormState.scala:61-62)
def errorsFor(path: FormPath): Vector[FormError]Returns validation errors at exactly path, preserving order.
Defined by scalive.FormState.errorsFor. View source (scalive/api/src/scalive/forms/FormState.scala:57-58)
isUsed
def isUsed(name: String): BooleanPermissively parses name, then checks whether that path is used.
Defined by scalive.FormState.isUsed. View source (scalive/api/src/scalive/forms/FormState.scala:53-54)
def isUsed(path: FormPath): BooleanWhether validation feedback for path should be visible.
Every path is considered used after submission; otherwise membership in used is exact.
Defined by scalive.FormState.isUsed. View source (scalive/api/src/scalive/forms/FormState.scala:49-50)
isValid
def isValid: BooleanWhether decoding and validation succeeded.
Defined by scalive.FormState.isValid. View source (scalive/api/src/scalive/forms/FormState.scala:37-37)
valueOption
def valueOption: Option[A]The decoded value when valid.
Defined by scalive.FormState.valueOption. View source (scalive/api/src/scalive/forms/FormState.scala:43-43)
Values4
raw
val raw: FormDataDefined by scalive.FormState.raw. View source (scalive/api/src/scalive/forms/FormState.scala:32-32)
submitted
val submitted: BooleanDefined by scalive.FormState.submitted. View source (scalive/api/src/scalive/forms/FormState.scala:35-35)
used
val used: Set[FormPath]Defined by scalive.FormState.used. View source (scalive/api/src/scalive/forms/FormState.scala:34-34)
value
val value: util.Either[FormErrors, A]Defined by scalive.FormState.value. View source (scalive/api/src/scalive/forms/FormState.scala:33-33)