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:
val city = FormPath("user", "address", "city")
city.name // "user[address][city]"
FormPath("tags").array.name // "tags[]"
FormPath.parse("tags[]") // FormPath(Vector("tags"))Parameters
segmentspath 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): FormPathAppends 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: FormPathAppends 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: StringReturns 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: BooleanWhether this path has no segments.
Defined by scalive.FormPath.isEmpty. View source (scalive/api/src/scalive/forms/FormPath.scala:32-32)
name
def name: StringRenders 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: BooleanWhether 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): BooleanWhether 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: StringReturns 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)