Skip to content
scalive
Menu
ConnectingLiveReconnectingOffline
c

RootedForm

class RootedForm[Owner, A]

A form whose field access is restricted to definitions owned by the same FormRoot.

This is a type-safe facade over Form. Rendering, event bindings, recovery settings, ordinary HTTP submission, and field views delegate without changing their behavior.

Type parameters

Owner

the singleton type of the owning root

A

the decoded whole-form value type

Defined by scalive.RootedForm. View source (scalive/api/src/scalive/forms/FormDefinition.scala:494-548)

Methods8

disableRecovery

def disableRecovery: Mod.Attr[Nothing]

Disables Phoenix's automatic form recovery by rendering phx-auto-recover="ignore".

Defined by scalive.RootedForm.disableRecovery. View source (scalive/api/src/scalive/forms/FormDefinition.scala:531-532)

field

def field[B](definition: RootedFormField[Owner, B]): FormFieldView[B]

Returns the current view of a field owned by this form's root.

Ownership is checked at compile time; the underlying field is already fully rooted.

Defined by scalive.RootedForm.field. View source (scalive/api/src/scalive/forms/FormDefinition.scala:546-547)

http

def http[Msg](target: FormAction)(mods: |[Mod[Msg], IterableOnce[Mod[Msg]]]*): HtmlElement[Msg]

Renders an ordinary browser form targeting target.

This delegates to http; it does not add LiveView change or submit bindings unless they are supplied in mods.

Defined by scalive.RootedForm.http. View source (scalive/api/src/scalive/forms/FormDefinition.scala:505-509)

onChange

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

Binds phx-change and decodes each event with this form's codec.

The callback runs for successful and failed decodes. Rebuild state explicitly with the owning from method when handling the resulting message.

Defined by scalive.RootedForm.onChange. View source (scalive/api/src/scalive/forms/FormDefinition.scala:516-517)

onRecover

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

Binds phx-auto-recover and decodes recovery events with this form's codec.

Defined by scalive.RootedForm.onRecover. View source (scalive/api/src/scalive/forms/FormDefinition.scala:527-528)

onSubmit

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

Binds phx-submit and decodes each event with this form's codec.

The event is marked submitted and the callback runs even when decoding fails.

Defined by scalive.RootedForm.onSubmit. View source (scalive/api/src/scalive/forms/FormDefinition.scala:523-524)

state

def state: FormState[A]

The current raw, decoded, used-field, and submission state.

Defined by scalive.RootedForm.state. View source (scalive/api/src/scalive/forms/FormDefinition.scala:498-498)

triggerHttpSubmitWhen

def triggerHttpSubmitWhen(condition: Boolean): Mod.Attr[Nothing]

Renders phx-trigger-action when condition is true.

On a form with an ordinary action and method, Phoenix uses this attribute to hand a Live submit back to the browser for normal HTTP submission.

Defined by scalive.RootedForm.triggerHttpSubmitWhen. View source (scalive/api/src/scalive/forms/FormDefinition.scala:539-540)