Skip to content
scalive
Menu
ConnectingLiveReconnectingOffline
c

FormPath

class FormPath(segments: Vector[String])

A structured form field path rendered with browser bracket notation.

Empty segments represent array brackets when a path is constructed explicitly with array. Parsing is deliberately permissive and lossy: parse ignores stray closing brackets, accepts an unterminated opening bracket, and drops empty segments, including []. It is intended to normalize browser-provided names rather than validate their grammar.

For example:

scala
val city = FormPath("user", "address", "city")
city.name                         // "user[address][city]"
FormPath("tags").array.name      // "tags[]"
FormPath.parse("tags[]")         // FormPath(Vector("tags"))

Parameters

segments

path segments in order; an empty segment renders as [] after the first segment

Defined by scalive.FormPath. View source (scalive/api/src/scalive/forms/FormPath.scala:21-56)

Methods8

/

def /(segment: String): FormPath

Appends segment without parsing or filtering it. An empty segment renders as array brackets.

Defined by scalive.FormPath./. View source (scalive/api/src/scalive/forms/FormPath.scala:24-25)

array

def array: FormPath

Appends an empty segment so that a non-empty path's browser name ends in [].

Defined by scalive.FormPath.array. View source (scalive/api/src/scalive/forms/FormPath.scala:28-29)

id

def id: String

Returns a conventional DOM id by dropping empty segments and joining the rest with _.

This transformation is not injective, so callers that need a unique id must handle collisions.

Defined by scalive.FormPath.id. View source (scalive/api/src/scalive/forms/FormPath.scala:47-48)

isEmpty

def isEmpty: Boolean

Whether this path has no segments.

Defined by scalive.FormPath.isEmpty. View source (scalive/api/src/scalive/forms/FormPath.scala:32-32)

name

def name: String

Renders the path as a browser field name, such as user[address][city].

Defined by scalive.FormPath.name. View source (scalive/api/src/scalive/forms/FormPath.scala:38-41)

nonEmpty

def nonEmpty: Boolean

Whether this path has at least one segment.

Defined by scalive.FormPath.nonEmpty. View source (scalive/api/src/scalive/forms/FormPath.scala:35-35)

startsWith

def startsWith(prefix: FormPath): Boolean

Whether this path begins with exactly the same segments as prefix.

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

toString

def toString: String

Returns name.

Defined by scalive.FormPath.toString. View source (scalive/api/src/scalive/forms/FormPath.scala:55-55)

Values1

segments

val segments: Vector[String]

Defined by scalive.FormPath.segments. View source (scalive/api/src/scalive/forms/FormPath.scala:21-21)