Skip to content
scalive
Menu
ConnectingLiveReconnectingOffline
o

FormCodec

object FormCodec

Constructors and common codecs for FormCodec.

Defined by scalive.FormCodec. View source (scalive/api/src/scalive/forms/FormCodec.scala:52-109)

Methods3

apply

def apply[A](f: FormData => Either[FormErrors, A]): FormCodec[A]

Creates a codec from a decoding function.

Defined by scalive.FormCodec.apply. View source (scalive/api/src/scalive/forms/FormCodec.scala:58-60)

optionalString

def optionalString(name: String): FormCodec[Option[String]]

Decodes the last value for name, returning None when it is missing or empty.

Duplicate names are accepted and earlier values are ignored. This intentionally differs from optionalString, which rejects duplicate scalar submissions. Whitespace is retained.

Defined by scalive.FormCodec.optionalString. View source (scalive/api/src/scalive/forms/FormCodec.scala:103-104)

def optionalString(path: FormPath): FormCodec[Option[String]]

Decodes the optional last string value under the rendered path name.

Defined by scalive.FormCodec.optionalString. View source (scalive/api/src/scalive/forms/FormCodec.scala:107-108)

requiredString

def requiredString(name: String, message: String = ...): FormCodec[String]

Decodes the last value for name and rejects a missing or empty last value.

Duplicate names are accepted and earlier values are ignored. This intentionally differs from requiredString, whose scalar field codec rejects duplicates. Whitespace is not trimmed. Failure produces one error at FormPath.parse(name).

Defined by scalive.FormCodec.requiredString. View source (scalive/api/src/scalive/forms/FormCodec.scala:68-76)

def requiredString(path: FormPath): FormCodec[String]

Decodes a required last string value under path with the default message.

The rendered path name is used for lookup and is reparsed when creating an error. Consequently, empty array segments in path are absent from the error path.

Defined by scalive.FormCodec.requiredString. View source (scalive/api/src/scalive/forms/FormCodec.scala:83-84)

def requiredString(path: FormPath, message: String): FormCodec[String]

Decodes a required last string value under path with message on failure.

The rendered path name is used for lookup and is reparsed when creating an error. Consequently, empty array segments in path are absent from the error path.

Defined by scalive.FormCodec.requiredString. View source (scalive/api/src/scalive/forms/FormCodec.scala:91-95)

Values1

formData

val formData: FormCodec[FormData]

The identity codec, which always returns its input.

Defined by scalive.FormCodec.formData. View source (scalive/api/src/scalive/forms/FormCodec.scala:54-55)