Skip to content
scalive
Menu
ConnectingLiveReconnectingOffline
GitHub
o

FieldInput

object FieldInput

Constructors for common editable-input shapes and custom structural codecs.

Defined by scalive.FieldInput. View source (scalive/api/src/scalive/forms/FieldInput.scala:16-90)

Methods4

apply

def apply[Input](decoder: Vector[String] => Either[FieldIssues, Input], encoder: Input => Vector[String]): FieldInput[Input]

Builds a bidirectional editable-input codec.

Defined by scalive.FieldInput.apply. View source (scalive/api/src/scalive/forms/FieldInput.scala:18-23)

checkbox

def checkbox(checkedValue: String = ..., invalidIssue: FieldIssue = ..., duplicateIssue: FieldIssue = ...): FieldInput[Boolean]

A strict checkbox codec: absence is false; exactly one checkedValue is true.

Matching is exact, including an empty checked token. Any other singleton reports invalidIssue; multiple values always report duplicateIssue, regardless of their tokens. Encoding omits false and emits only checkedValue for true; there is no hidden false value convention. Requiring the checkbox to be checked is a separate semantic refinement.

Use the same token in the renderer: a field declared with FieldInput.checkbox("yes") should be rendered with form.field(field).checkbox("yes").

Defined by scalive.FieldInput.checkbox. View source (scalive/api/src/scalive/forms/FieldInput.scala:51-69)

optionalText

def optionalText(empty: String = ..., duplicateIssue: FieldIssue = ...): FieldInput[Option[String]]

A single-value codec where absence and the configured empty value decode to None.

Defined by scalive.FieldInput.optionalText. View source (scalive/api/src/scalive/forms/FieldInput.scala:72-86)

text

def text(default: String = ..., duplicateIssue: FieldIssue = ...): FieldInput[String]

A single-value text codec; absence becomes default and duplicates are rejected.

Defined by scalive.FieldInput.text. View source (scalive/api/src/scalive/forms/FieldInput.scala:26-39)

Values1

texts

val texts: FieldInput[Vector[String]]

Preserves all submitted values verbatim and in encounter order.

Defined by scalive.FieldInput.texts. View source (scalive/api/src/scalive/forms/FieldInput.scala:89-89)