# update\_iframe

Source: https://zotonic.com/docs/2041/update_iframe

URI: https://zotonic.com/id/2041

Language: en



::: {.note title="Note"}
This action is only used to update an `iframe` element. Use the <a href="/id/doc_template_action_action_update" class="doc-reference doc-reference-action"><code>action#update</code></a> action for updating the contents of a normal HTML element.
:::

Updates the content of an iframe with a template or a literal HTML text.

Example:

```django
<iframe id="preview"></iframe>
{% button text="Show Email" action={update_iframe target="preview" template="email.tpl" recipient_id=m.acl.user} %}
```

When clicked, the contents of the iframe will be set to the rendered `email.tpl` template. This replaces any content present.

| Argument   | Description                                                                      | Example                       |
| ---------- | -------------------------------------------------------------------------------- | ----------------------------- |
| target     | The id of the iframe receiving the rendered HTML document.                       | target=”my-view”              |
| text       | Literal HTML doc to be inserted, no escaping will be done.                       | text=”&lt;html>...&lt;/html>” |
| template   | Name of the template to be rendered.                                             | template=”page.tpl”           |
| catinclude | Add this argument to use a <a href="/id/doc_template_tag_tag_catinclude" class="doc-reference doc-reference-tag"><code>tag#catinclude</code></a> instead of a normal include of the template. The id argument *must* be present for a catinclude to work. | catinclude id=1               |

All other arguments are passed as-is to the included template(s).

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/2041?language=en


## API access

- [API help](<https://zotonic.com/api-help>)
- [OpenAPI specification](<https://zotonic.com/openapi.json>)
- [This resource as JSON](<https://zotonic.com/api/agent/resource/2041?language=en>)
