diff --git a/en/use-dify/nodes/template.mdx b/en/use-dify/nodes/template.mdx index 2a2e91bd9..e450cf203 100644 --- a/en/use-dify/nodes/template.mdx +++ b/en/use-dify/nodes/template.mdx @@ -62,7 +62,7 @@ Jinja2 filters transform data during template rendering: {{ name | upper }} {{ price | round(2) }} {{ content | replace('\n', '
') }} -{{ timestamp | strftime('%B %d, %Y') }} +{{ tags | join(', ') }} {{ score | default('No score available') }} ``` @@ -77,30 +77,107 @@ Handle missing or invalid data gracefully using default values and conditional c ## Interactive Forms -Templates can generate interactive HTML forms for structured data collection in chat interfaces: +Templates can generate interactive HTML forms for structured data collection in Chatflows. + +On submit, the form values are sent to the chat as the end user's next message. The format depends on the `
`'s `data-format` attribute: + +- **`data-format="json"`**: values are serialized as a JSON object. A downstream Code node or Parameter Extractor can `JSON.parse` it (or pattern-match it) to pull out each field. +- **Unset (or any other value)**: values are sent as plain text, one `name: value` per line. Easier for an LLM to read. + +For example: + + + ```html - - - - - - - - - - + + + + + + + + + + + + + + + ``` - - ![Interactive Form Rendered in Chat Interface](https://assets-docs.dify.ai/2025/04/9d24e9cfa3cdde00e4eee15bd4bbea76.png) + + + + Interactive Form Rendered in Chat Interface + + +
+ +### Supported Tags + +|
Tag
| Attributes | Notes | +|:---|:---|:---| +| `
` | `data-format` | Container for form fields.



Set `data-format="json"` to receive submissions as JSON; any other value (or unset) sends plain text. | +| `