update

See also

actions update_iframe, insert_top and insert_bottom.

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

Example:

<div id="mydiv"><p>Bye Bye.</p></div>
{% button text="hello" action={update target="mydiv" text="<p>Hello World!</p>"} %}

When clicked, the contents of the div will be set to the HTML fragment <p>Hello World!</p>. This replaces any content present.

Note

Use the update_iframe action for updating the contents of an iframe element.

Another example, now rendering a template:

<ul id="mylist"><li>Some item</li></li>
{% button text="hello" action={update target="mylist" template="_list_item.tpl" id=42} %}

This updates the <ul/> with the output of the template _list_item.tpl. All arguments to the update action are also arguments to the template.

ArgumentDescriptionExample
targetThe id of the element receiving the rendered HTML.target=”my-view”
textLiteral HTML text to be inserted, no escaping will be done.text=”Hello <b>World</b>”
templateName of the template to be rendered.template=”_list_view.tpl”
include_allAdd this argument to include all templates with the same name. If not added then the best template will be used.include_all
catincludeAdd this argument to use a catinclude 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).

Edit on GitHub

unmask DOM Elements update_iframe

Referred by

Actions

An overview of all wire actions.