Renders a case class as an HTML form, and reads one back.
Form emits the whole `` element rather than a bag of inputs, because it is the one place that knows both the target verb and the encoding, and so it is the only place that can own the _method override. A Resource hands it Method.PUT without knowing the override exists. The CSRF token is the other reserved input for unsafe forms, and it is a required parameter of render rather than a default or a given: callers cannot accidentally omit it from a form that needs protection, and the caller already holds it as request.csrf.
The key is never rendered. A form that carried its own key would either need a placeholder value meaning "not set", which is a real value the server cannot tell from a real one, or a hidden input, which the browser lets the user edit. Instead parse takes the key as raw text from the caller: Id.gen().show on create, the path parameter on update, decoded through the key field's own Field so there is one decoder rather than two.
Attributes
- Companion
- object
- Source
- Form.scala
- Graph
-
- Supertypes