Skip to content
scalive
Menu
ConnectingLiveReconnectingOffline
c

FormFieldView

class FormFieldView[A]

Current raw, decoded, validation, and rendering state for one field.

Obtain a view from field or field. A view does not mutate its form. Its control helpers render the field's derived name, ID, and current raw value, followed by caller modifiers. Validation display is split between all errors and interaction-gated visibleErrors.

Type parameters

A

the decoded field value type

Defined by scalive.FormFieldView. View source (scalive/api/src/scalive/forms/Form.scala:358-536)

Methods21

checkbox

def checkbox[Msg](checkedValue: String, mods: |[Mod[Msg], IterableOnce[Mod[Msg]]]*): HtmlElement[Msg]

Renders a checkbox with checkedValue as its submitted value.

The checkbox is checked when rawValues contains checkedValue. No hidden unchecked value is generated.

Defined by scalive.FormFieldView.checkbox. View source (scalive/api/src/scalive/forms/Form.scala:461-472)

def checkbox[Msg](mods: |[Mod[Msg], IterableOnce[Mod[Msg]]]*): HtmlElement[Msg]

Renders a checkbox whose submitted value is "true".

Defined by scalive.FormFieldView.checkbox. View source (scalive/api/src/scalive/forms/Form.scala:453-454)

decoded

def decoded: Either[FormErrors, A]

Decodes this field afresh from the form's complete raw payload.

Defined by scalive.FormFieldView.decoded. View source (scalive/api/src/scalive/forms/Form.scala:391-391)

email

def email[Msg](mods: |[Mod[Msg], IterableOnce[Mod[Msg]]]*): HtmlElement[Msg]

Renders an email input with the default ID, name, and current raw value.

Defined by scalive.FormFieldView.email. View source (scalive/api/src/scalive/forms/Form.scala:441-442)

errorFeedback

def errorFeedback(mods: |[Mod[Nothing], IterableOnce[Mod[Nothing]]]*): HtmlElement[Nothing]

Renders interaction-visible errors paired with validationAttributes.

The wrapper is a div with errorId, phx-feedback-for, aria-live="polite", and class form-errors. Caller modifiers, including content, are appended before each generated span.form-error. The stable wrapper remains present when no errors are visible, but caller content is still rendered.

Defined by scalive.FormFieldView.errorFeedback. View source (scalive/api/src/scalive/forms/Form.scala:505-518)

errorId

def errorId: String

The DOM ID used by errorFeedback and validationAttributes.

Defined by scalive.FormFieldView.errorId. View source (scalive/api/src/scalive/forms/Form.scala:373-373)

errors

def errors: Vector[FormError]

Returns validation errors for this field, even when it has not been used.

Typed views preserve every error at their exact path. Relative-path views combine rooted and relative errors and remove duplicates. Use visibleErrors for interaction-gated presentation.

Defined by scalive.FormFieldView.errors. View source (scalive/api/src/scalive/forms/Form.scala:399-400)

feedback

def feedback(mods: |[Mod[Nothing], IterableOnce[Mod[Nothing]]]*): HtmlElement[Nothing]

Renders a Phoenix feedback container for this field.

This lower-level helper sets only phx-feedback-for before appending caller modifiers, including content. It does not generate errors or the accessibility ID supplied by errorFeedback.

Defined by scalive.FormFieldView.feedback. View source (scalive/api/src/scalive/forms/Form.scala:526-527)

fieldValue

def fieldValue: String

Returns the last raw value, or the empty string when the field is absent.

Defined by scalive.FormFieldView.fieldValue. View source (scalive/api/src/scalive/forms/Form.scala:388-388)

hasVisibleErrors

def hasVisibleErrors: Boolean

Tests whether at least one interaction-visible error exists.

Defined by scalive.FormFieldView.hasVisibleErrors. View source (scalive/api/src/scalive/forms/Form.scala:414-414)

hidden

def hidden[Msg](mods: |[Mod[Msg], IterableOnce[Mod[Msg]]]*): HtmlElement[Msg]

Renders a hidden input with the default ID, name, and current raw value.

Defined by scalive.FormFieldView.hidden. View source (scalive/api/src/scalive/forms/Form.scala:449-450)

id

def id: String

The default DOM ID derived from path.

Defined by scalive.FormFieldView.id. View source (scalive/api/src/scalive/forms/Form.scala:370-370)

isUsed

def isUsed: Boolean

Tests whether this field is eligible to show validation errors.

A field is used when tracked by the current state; every field is used after submission.

Defined by scalive.FormFieldView.isUsed. View source (scalive/api/src/scalive/forms/Form.scala:406-407)

name

def name: String

The browser field name derived from path.

Defined by scalive.FormFieldView.name. View source (scalive/api/src/scalive/forms/Form.scala:367-367)

password

def password[Msg](mods: |[Mod[Msg], IterableOnce[Mod[Msg]]]*): HtmlElement[Msg]

Renders a password input with the default ID, name, and current raw value.

Defined by scalive.FormFieldView.password. View source (scalive/api/src/scalive/forms/Form.scala:445-446)

path

def path: FormPath

The complete rooted field path.

Defined by scalive.FormFieldView.path. View source (scalive/api/src/scalive/forms/Form.scala:364-364)

rawValues

def rawValues: Vector[String]

Returns all raw values for this field in submission order.

Views created from a relative path try the rooted path first and fall back to the exact relative path only when no rooted values exist. Typed field views read their exact path.

Defined by scalive.FormFieldView.rawValues. View source (scalive/api/src/scalive/forms/Form.scala:380-385)

select

def select[Msg](options: Iterable[(String, String)], mods: |[Mod[Msg], IterableOnce[Mod[Msg]]]*): HtmlElement[Msg]

Renders a select from (submittedValue, label) options.

Every option whose submitted value occurs in rawValues is marked selected. Supply ordinary select modifiers, such as multiple, through mods when needed.

Defined by scalive.FormFieldView.select. View source (scalive/api/src/scalive/forms/Form.scala:483-496)

text

def text[Msg](explicitId: String, mods: |[Mod[Msg], IterableOnce[Mod[Msg]]]*): HtmlElement[Msg]

Renders a text input with explicitId, name, and fieldValue.

errorId remains derived from the field's default id.

Defined by scalive.FormFieldView.text. View source (scalive/api/src/scalive/forms/Form.scala:434-438)

def text[Msg](mods: |[Mod[Msg], IterableOnce[Mod[Msg]]]*): HtmlElement[Msg]

Renders a text input with the default id, name, and fieldValue.

Defined by scalive.FormFieldView.text. View source (scalive/api/src/scalive/forms/Form.scala:427-428)

textarea

def textarea[Msg](mods: |[Mod[Msg], IterableOnce[Mod[Msg]]]*): HtmlElement[Msg]

Renders a textarea whose text content is fieldValue.

Defined by scalive.FormFieldView.textarea. View source (scalive/api/src/scalive/forms/Form.scala:475-476)

validationAttributes

def validationAttributes: Vector[Mod.Attr[Nothing]]

Returns accessibility attributes paired with errorFeedback.

aria-describedby always references errorId, allowing a stable relationship across patches. aria-invalid="true" is included only when hasVisibleErrors is true. Pass these modifiers to the corresponding control.

Defined by scalive.FormFieldView.validationAttributes. View source (scalive/api/src/scalive/forms/Form.scala:422-424)

visibleErrors

def visibleErrors: Vector[FormError]

Returns errors only when isUsed is true.

Defined by scalive.FormFieldView.visibleErrors. View source (scalive/api/src/scalive/forms/Form.scala:410-411)