# with\_args

Source: https://zotonic.com/docs/1814/with_args

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

Language: en



Apply actions with arguments added.

This action takes a list of other actions. One or more arguments are added to the actions before the actions are executed. This action is mostly used in included templates or callbacks. An example can be seen with the <a href="/id/doc_template_action_action_typeselect" class="doc-reference doc-reference-action"><code>action#typeselect</code></a> action.

Another example, assume we have a template “\_list\_action.tpl”:

```erlang
{% for id in list %}
  <li><a id="{{ #list.id }}" href="#">{{ m.rsc[id].title }}</a></li>
  {% wire id=#list.id action={with_args action=my_action arg={id id}} %}
{% endfor %}
```

Then we can pass an action to this template:

```erlang
{% include "_list_action.tpl" list=[1,2,3,4,5] my_action={redirect dispatch="admin_edit_rsc"} %}
```

The result will be a list of titles for the pages with id 1..5. Every title will be a link to its admin page, as the argument id will be added to the my\_action.

License: 

Attribution: 

Related resources: https://zotonic.com/api/agent/related/1814?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/1814?language=en>)
