# dialog\_new\_rsc

Source: https://zotonic.com/docs/1834/dialog_new_rsc

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

Language: en



Show the admin dialog for creating a new [resource](/id/doc_glossary#term-resource).

When the resource is created, the user is redirected to the admin edit page. This action exports a postback called `new_page` which is used to create the page:

```django
{% wire id=#form type="submit"
      postback={new_page subject_id=subject_id predicate=predicate redirect=redirect
                        actions=actions callback=callback}
      delegate=`action_admin_dialog_new_rsc`
%}
```

This postback has the following arguments:

- `subject_id` + `predicate`: Create an edge from the given subject to this new page, using the given predicate.
- `redirect`: Boolean flag whether or not to redirect to the edit page. Defaults to `true`.
- `actions`: Any actions to perform after the resource is created.
- `callback`: JavaScript function to call when the subject edge has been created.
- `objects`: A list of `[object, predicate]` pairs which are created as outgoing edges from the new page to the given objects. The object can be a resource ID or a resource name. Example:

```django
objects=[ [m.acl.user, "author"] ]
```

creates an “author” edge from the new page to the currently logged in user.

The dialog action itself also accepts `cat`, `nocatselect`, `tabs_enabled`, `title`, `redirect`, `subject_id`, `object_id`, `predicate`, repeatable `action`, repeatable `object`, and `callback` arguments. `redirect` defaults to `true`.

```django
{% button text="New article" action={dialog_new_rsc cat="article" redirect} %}
```

License: 

Attribution: 

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