Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To generate the HTML, use the form_input_name and html_input filters.

Input:

Code Block
{{ "Name" | form_input_name | html_input: "checkbox" }}

...

Code Block
<input type="checkbox" name="form_message[content][name]">

With JSON endpoint

It is possible to send the request for a form to a JSON endpoint. You can read more about this in the docs for form tag. When sending in the content for each field, every field just handles like "key": "value" in the form JSON. However, content for file fields need to be decoded as base64, and accept a JSON object as content:

Code Block
{
  "form_message": {
    "content": {
      "content_field_a" => "value",
      "file_field_b" => {
        "base64": true,
        "filename": "my-image.png",
        "body": "base-64-string..."
      }
    }
  }
}  

The filename key is optional. When it is not given the filename is generated randomly and the extension extracted from the base64 string, if possible.