Skip to content
scalive
Menu
ConnectingLiveReconnectingOffline
GitHub
c

FormDefinition

class FormDefinition[Owner, Domain]

One coherent schema responsible for projection, validation, events, and rebuilding.

Start with product, then use initial for server values or event for an untrusted browser payload. The path-dependent aliases keep forms, events, snapshots, and workflows tied to this exact definition instance.

Defined by scalive.FormDefinition. View source (scalive/api/src/scalive/forms/FormDefinition.scala:61-714)

Types10

AppliedUpdate

type AppliedUpdate = AppliedFormUpdate[Owner, type, Domain]

Result of applying an interaction-aware update owned by this exact definition.

Defined by scalive.FormDefinition.AppliedUpdate. View source (scalive/api/src/scalive/forms/FormDefinition.scala:88-88)

Binding

type Binding = ([Msg] =>> FormBinding[Owner, type, Domain, Msg])

Rendering and interaction bindings for one instance of this definition.

Defined by scalive.FormDefinition.Binding. View source (scalive/api/src/scalive/forms/FormDefinition.scala:82-82)

Event

type Event = FormEvent[Owner, type, Domain]

Typed event rebuilt by this exact definition.

Defined by scalive.FormDefinition.Event. View source (scalive/api/src/scalive/forms/FormDefinition.scala:79-79)

Form

type Form = Form[Owner, type, Domain]

Current form owned by this exact definition.

Defined by scalive.FormDefinition.Form. View source (scalive/api/src/scalive/forms/FormDefinition.scala:76-76)

Schema

type Schema = type

Singleton identity used to prevent mixing artifacts from distinct definitions.

Defined by scalive.FormDefinition.Schema. View source (scalive/api/src/scalive/forms/FormDefinition.scala:70-70)

Snapshot

type Snapshot = ValidFormSnapshot[Owner, type, Domain]

Valid value snapshot owned by this exact definition.

Defined by scalive.FormDefinition.Snapshot. View source (scalive/api/src/scalive/forms/FormDefinition.scala:97-97)

Submitter

type Submitter = ([Action <: reflect.Enum] =>> FormSubmitter[Owner, type, Action])

Submitter contract owned by this exact definition.

Defined by scalive.FormDefinition.Submitter. View source (scalive/api/src/scalive/forms/FormDefinition.scala:91-91)

Update

type Update = FormUpdate[Owner, type, Domain]

Interaction-aware update owned by this exact definition.

Defined by scalive.FormDefinition.Update. View source (scalive/api/src/scalive/forms/FormDefinition.scala:85-85)

Values

type Values = FormValues[Owner, type]

Editable values owned by this exact definition.

Defined by scalive.FormDefinition.Values. View source (scalive/api/src/scalive/forms/FormDefinition.scala:73-73)

Workflow

type Workflow = ([Failure] =>> FormWorkflow[Owner, type, Domain, Failure])

Save workflow whose current and baseline values share this definition.

Defined by scalive.FormDefinition.Workflow. View source (scalive/api/src/scalive/forms/FormDefinition.scala:94-94)

Methods12

emap

def emap[B](f: Domain => Either[FormErrors[Owner], B]): FormDefinition[Owner, B]

Applies error-producing whole-product refinement using a fresh definition identity.

Defined by scalive.FormDefinition.emap. View source (scalive/api/src/scalive/forms/FormDefinition.scala:198-201)

errors

def errors(issue: FieldIssue): FormErrors[Owner]

Creates a product-level error at this definition's root address.

Defined by scalive.FormDefinition.errors. View source (scalive/api/src/scalive/forms/FormDefinition.scala:208-209)

def errors[Group, Row](rows: RepeatedRows[Owner, Group, Row], issue: FieldIssue): FormErrors[Owner]

Creates an error for a repeated group declared by this definition.

Defined by scalive.FormDefinition.errors. View source (scalive/api/src/scalive/forms/FormDefinition.scala:220-225)

def errors[Input, Value](field: FormField[Owner, Input, Value], issue: FieldIssue): FormErrors[Owner]

Creates an error for a static field declared by this definition.

Defined by scalive.FormDefinition.errors. View source (scalive/api/src/scalive/forms/FormDefinition.scala:212-217)

event

def event(data: FormData, kind: FormEventKind): Event

Projects an untrusted browser payload and returns a consistent typed event.

Projection is bounded by limits. The event retains the original payload while its form contains only canonical schema-owned values and structural errors.

Defined by scalive.FormDefinition.event. View source (scalive/api/src/scalive/forms/FormDefinition.scala:127-128)

fromValues

def fromValues(values: Values): Form

Revalidates this definition's values with pristine interaction.

Defined by scalive.FormDefinition.fromValues. View source (scalive/api/src/scalive/forms/FormDefinition.scala:131-132)

def fromValues(values: Values, interaction: FormInteraction[Owner]): Form

Revalidates values while preserving an existing interaction state.

Defined by scalive.FormDefinition.fromValues. View source (scalive/api/src/scalive/forms/FormDefinition.scala:135-136)

initial

def initial(assignments: FormInitial[Owner]*): Form

Creates a pristine form from typed or explicitly raw schema-owned assignments.

Assignments must originate from fields and repeated groups declared by this definition.

Defined by scalive.FormDefinition.initial. View source (scalive/api/src/scalive/forms/FormDefinition.scala:118-120)

map

def map[B](f: Domain => B): FormDefinition[Owner, B]

Applies dependent whole-product refinement using a fresh definition identity.

Defined by scalive.FormDefinition.map. View source (scalive/api/src/scalive/forms/FormDefinition.scala:194-195)

onChange

def onChange[Msg](changed: Event => Msg, recovered: Event => Msg): Mod.Attr[Msg]

Handles LiveView phx-change and recovery with separate typed callbacks.

Defined by scalive.FormDefinition.onChange. View source (scalive/api/src/scalive/forms/FormDefinition.scala:148-157)

def onChange[Msg](f: Event => Msg): Mod.Attr[Msg]

Handles LiveView phx-change and recovery as typed definition-owned events.

Defined by scalive.FormDefinition.onChange. View source (scalive/api/src/scalive/forms/FormDefinition.scala:139-145)

onRecover

def onRecover[Msg](f: Event => Msg): Mod.Attr[Msg]

Handles LiveView recovery as a typed event.

Defined by scalive.FormDefinition.onRecover. View source (scalive/api/src/scalive/forms/FormDefinition.scala:190-191)

onSubmit

def onSubmit[Action <: reflect.Enum, Msg](submitter: Submitter[Action])(f: (Event, Either[FormSubmitter.DecodeError, Action]) => Msg): Mod.Attr[Msg]

Handles submit events and decodes one action from this definition's submitter contract.

Defined by scalive.FormDefinition.onSubmit. View source (scalive/api/src/scalive/forms/FormDefinition.scala:164-170)

def onSubmit[Msg](f: Event => Msg): Mod.Attr[Msg]

Handles submit events; submitted forms expose all validation errors.

Defined by scalive.FormDefinition.onSubmit. View source (scalive/api/src/scalive/forms/FormDefinition.scala:160-161)

submitter

def submitter[Action <: reflect.Enum](actions: IterableOnce[Action])(wireValue: Action => String): Submitter[Action]

Declares finite submit actions under a generated, collision-free browser field name.

Defined by scalive.FormDefinition.submitter. View source (scalive/api/src/scalive/forms/FormDefinition.scala:173-178)

def submitter[Action <: reflect.Enum](actions: IterableOnce[Action], wireName: String)(wireValue: Action => String): Submitter[Action]

Declares finite submit actions under a checked custom browser field name.

Defined by scalive.FormDefinition.submitter. View source (scalive/api/src/scalive/forms/FormDefinition.scala:181-187)

withLimits

def withLimits(value: FormLimits): FormDefinition[Owner, Domain]

Returns an equivalent definition with new projection limits and a fresh schema identity.

Defined by scalive.FormDefinition.withLimits. View source (scalive/api/src/scalive/forms/FormDefinition.scala:204-205)

workflow

def workflow[Failure](form: Form): Workflow[Failure]

Starts a FormWorkflow whose baseline is the supplied form's current values.

Defined by scalive.FormDefinition.workflow. View source (scalive/api/src/scalive/forms/FormDefinition.scala:228-229)

Values3

address

val address: FormAddress[Owner]

Logical root address used for product-level errors.

Defined by scalive.FormDefinition.address. View source (scalive/api/src/scalive/forms/FormDefinition.scala:102-102)

limits

val limits: FormLimits

Defined by scalive.FormDefinition.limits. View source (scalive/api/src/scalive/forms/FormDefinition.scala:66-66)

root

val root: FormPath

Defined by scalive.FormDefinition.root. View source (scalive/api/src/scalive/forms/FormDefinition.scala:62-62)