std:new_object_editor

Create an editor for a proposed new object in the store based, on a supplied template object. Use this to offer the user an object with pre-filled fields, ready for editing, confirmation, and saving.

The HTML <form> generated will POST the object to a handler provided by the Platform, so there’s no need for your plugin to do anything more than display the result of this template.

Obtain a Template object with P.template("std:new_object_editor"), or use the template:std:new_object_editor() template function.

View

key templateObject

A template StoreObject, created with O.object().

This must contain at least a Type attribute, using the schema TYPE constants.

key successRedirect

Optional. If this key is specified, the user’s browser will be redirected to this path after successful creation of the new object.

The path must be a string beginning with ‘/’, and not contain any strange characters. Use URL %-encoding to include other characters.

A parameter for the new object’s reference will be appended to the URL. If the ref is 88x56, and the URL contains a ‘?’, "&ref=88x56" will be appended to the URL, otherwise "?ref=88x56"

If this path is not specified, the user will be redirected to the object page.

NOTE: Do not rely on this redirect to ensure that important actions are performed, as it depends on the browser making a request. Problems on the client side or in the network could cause this redirect to fail. Use the hPostObjectChange hook to observe object creation reliably.