Skip to content
scalive
Menu
ConnectingLiveReconnectingOffline
c

FormData

class FormData

An ordered browser form payload that preserves duplicate textual fields.

raw is the lossless representation: it retains every name-value pair in encounter order. Scalar accessors deliberately select the last value for a name, while values retains all duplicates. Names remain bracket-encoded strings rather than being expanded into nested maps.

For example:

scala
val data = FormData(Vector("tag" -> "first", "tag" -> "second"))
data.values("tag") // Vector("first", "second")
data.get("tag")    // Some("second")
data.asMap          // Map("tag" -> "second")

Parameters

raw

textual field pairs in encounter order

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

Methods7

asMap

def asMap: Map[String, String]

Returns a lossy map containing only the last value for each exact field name.

Defined by scalive.FormData.asMap. View source (scalive/api/src/scalive/forms/FormData.scala:69-70)

contains

def contains(name: String): Boolean

Whether at least one pair has the exact field name name, regardless of its value.

Defined by scalive.FormData.contains. View source (scalive/api/src/scalive/forms/FormData.scala:63-63)

def contains(path: FormPath): Boolean

Whether at least one pair has the rendered path name.

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

get

def get(name: String): Option[String]

Returns the last value submitted under name, including an empty string, if present.

Defined by scalive.FormData.get. View source (scalive/api/src/scalive/forms/FormData.scala:37-38)

def get(path: FormPath): Option[String]

Returns the last value submitted under the rendered path name.

Defined by scalive.FormData.get. View source (scalive/api/src/scalive/forms/FormData.scala:41-42)

getOrElse

def getOrElse(name: String, fallback: String): String

Returns the last value for name, or fallback when that name is absent.

Defined by scalive.FormData.getOrElse. View source (scalive/api/src/scalive/forms/FormData.scala:59-60)

nested

def nested(name: String): FormData

Extracts fields textually nested below name and removes that outer name.

A pair is included when its key starts with name + "[" and ends with ]. Encounter order and duplicates are preserved. Matching is textual rather than a strict FormPath parse, and the pair whose key is exactly name is not included.

Defined by scalive.FormData.nested. View source (scalive/api/src/scalive/forms/FormData.scala:78-85)

string

def string(name: String): Option[String]

Alias for get.

Defined by scalive.FormData.string. View source (scalive/api/src/scalive/forms/FormData.scala:45-45)

def string(path: FormPath): Option[String]

Alias for get.

Defined by scalive.FormData.string. View source (scalive/api/src/scalive/forms/FormData.scala:48-48)

values

def values(name: String): Vector[String]

Returns every value submitted under name, in encounter order.

Defined by scalive.FormData.values. View source (scalive/api/src/scalive/forms/FormData.scala:51-52)

def values(path: FormPath): Vector[String]

Returns every value submitted under the rendered path name.

Defined by scalive.FormData.values. View source (scalive/api/src/scalive/forms/FormData.scala:55-56)

Values2

fields

lazy val fields: Map[String, FormValues]

Groups values by exact field name while preserving each name's value order.

The map does not provide the cross-name ordering available from raw.

Defined by scalive.FormData.fields. View source (scalive/api/src/scalive/forms/FormData.scala:33-34)

raw

val raw: Vector[(String, String)]

Defined by scalive.FormData.raw. View source (scalive/api/src/scalive/forms/FormData.scala:28-28)