Custom Submit Content Form - Documentation topics on: custom submit content form,deprecated,macros,.

Custom Submit Content Form

** This macro has been deprecated. It is recommended that front end forms that submit content should use the content API. See the following documentation links which include sample forms: **
Content API
Save Content using REST API
Content API - Post
Content API - JSON & Binary Submit
Content API - JSONP

Webmasters can use the submit content macro to create a front-end form that allows the submission of content.  However, the submit content macro does not allow the webmaster to have control or manipulate the fields in the form.

To have more control of the submit content form, webmasters can manually add the fields and actions that the submit content macro adds automatically.  Webmasters can then extend their control over the form fields.  One of the limitations of the submit content macro is that it does not save form content to a folder.  Instead, it saves content to the host where the form is submitted.

A manually constructed submit content form can define a hidden field where a specific folder is named for the content to be saved to, as in the example form below.  See the comment code in the form to understand the purpose of each line.

Since the custom code lines below are just manual calls of the submit content macro actions, then the same options and settings can be used/set as with the submit content macro. For all available optional parameters, validations, etc., please see the submit content macro documentation.

##System Default Error handling in the form
 #set($errorMessagesPath = 'static/content/error_messages.vtl')


##Set options to "false" to save or "true" to save and publish content
#set($options = "contentAutoPublish=true;")

##Submit content action/values needed by all submit content forms
<form id="submitContentForm" name="submitContentForm" method="post" enctype="multipart/form-data" action="/dotCMS/submitContent">
<input type="hidden" value="submitContent" name="dispatch">
<input type="hidden" value="$crypt.crypt($options)" name="options">

##Content Type identifier is added as a value to identify content type Ex: b8308443-13c6-4f93-a88f-7624a7b25bc0
<input type="hidden" value="b8308443-13c6-4f93-a88f-7624a7b25bc0" name="contentType">

##page with the form "/test/"
<input id="referrer" type="hidden" value="/test/" name="referrer">
<input type="hidden" value="" name="userId">

headline: <input type="text" name="headline" id="headline" value="test"><br>

##host/folder field velocity variable on the Content Type Ex: "folderSave" and id of folder is "2ba73e3d-68a9-4639-8b29-9e7c161b0caf"
<input type="hidden" name="folderSave" id="branch" value="2ba73e3d-68a9-4639-8b29-9e7c161b0caf"/>

##id of host = 48190c8c-42c4-46af-8d1a-0cd5db894797
<input type="hidden" name="hostId" id="hostId" value="48190c8c-42c4-46af-8d1a-0cd5db894797"/>

##To submit the form
<br><br><input type=submit>