FormAction
object FormActionCreates checked route actions and explicit unsafe actions for ordinary HTML forms.
Defined by scalive.FormAction. View source (scalive/api/src/scalive/forms/FormAction.scala:28-130)
Methods3
from
def from(pattern: zio.http.RoutePattern[Unit]): FormActionEncodes a checked action from a route pattern without parameters.
Throws
FormAction.EncodingExceptionif the method is unsupported or the path cannot be encoded
Defined by scalive.FormAction.from. View source (scalive/api/src/scalive/forms/FormAction.scala:86-87)
def from[A](pattern: zio.http.RoutePattern[A], params: A): FormActionEncodes a checked action from a parameterized route pattern.
Only GET and POST patterns are accepted. Typed path parameters are formatted by pattern, a
leading slash is added, and the resulting URL is encoded. Checked POST actions request CSRF
token injection when rendered with http.
Parameters
patternthe typed route pattern that owns the method and path shape
paramsvalues used to format the route path
Throws
FormAction.EncodingExceptionif the method is unsupported or the path parameters cannot be encoded
Defined by scalive.FormAction.from. View source (scalive/api/src/scalive/forms/FormAction.scala:78-79)
fromEither
def fromEither(pattern: zio.http.RoutePattern[Unit]): Either[FormAction.EncodeError, FormAction]Encodes a checked action from a route pattern without parameters and without throwing.
Defined by scalive.FormAction.fromEither. View source (scalive/api/src/scalive/forms/FormAction.scala:112-113)
def fromEither[A](pattern: zio.http.RoutePattern[A], params: A): Either[FormAction.EncodeError, FormAction]Encodes a checked action from a parameterized route pattern without throwing.
Only GET and POST patterns are accepted. Typed path parameters are formatted by pattern, a
leading slash is added, and the resulting URL is encoded. Checked POST actions request CSRF
token injection when rendered with http.
Returns
- Returns
an EncodeError or the encoded action
Defined by scalive.FormAction.fromEither. View source (scalive/api/src/scalive/forms/FormAction.scala:98-109)
unsafe
def unsafe(method: FormAction.Method, href: String): FormActionCreates an unchecked action for an already encoded or external target.
This method performs no URL parsing, route formatting, same-origin check, or method-to-target
validation. It also explicitly disables Scalive CSRF-token injection, including when method
is Post. The caller must establish any required request integrity and target trust.
Use a checked route action whenever the target is owned by the application.
Defined by scalive.FormAction.unsafe. View source (scalive/api/src/scalive/forms/FormAction.scala:122-123)