Front End Content Editing

Last Updated: Oct 22, 2019
documentation for the dotCMS Content Management System

** 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: **

This macro generates a "front-end" form and permits content editing of a single piece of content from a page. This allows for *role based editing of existing content without the necessity of back end access. This macro does NOT, however, allow for the creation of new content. To create NEW content via a front-end form, webmasters should first create a "back-end form", utilize the submitContent macro to create a form, or create a custom submit content form.

*The "CMS Anonymous" role needs to have Edit permissions on the Content Type to allow "anonymous" front-end content editing.

Optionally, this macro can be used with captcha validation, create of a work flow task to a particular role moderator, and be set to automatically publish content, if desired. These and other settings are listed under "Options" in the "Macro Overview" section below.

Custom Field Handling

Custom fields are supported by the #submitContent and #submitContentEdit macros. Some javascript handling is required to display values in custom fields on the Front-end form. The sample code below can be placed in a custom code field named "source", which allows the front end content contributor to choose a host from a multi-select list that is dynamically created from existing hosts in the system:

##Multiselect for hosts where news and events will be pulled from
<select multiple size="10" id="msSource" name="msSource">
  #set($siteList = $dotcontent.pull('+contentType:Host
+live:true +deleted:false',0,'Host.hostName'))
   #foreach ($site in $siteList)
         <option value="$!{site.identifier}"
#if($listTool.contains($source.split(',') ,
"$site.identifier"))selected="selected" #end
<script type="text/javascript">
  function updateSource() {
    var sourceHosts = '';
      var hselect = document.getElementById("msSource");
      for(var i = 0; i    
< hselect.options.length; i++) {
          if(hselect.options[i].selected) {
              sourceHosts = sourceHosts + ',' + hselect.options[i].value;
      document.getElementById("source").value = sourceHosts;
  // Connect the onChange to the select
  dojo.connect(dojo.byId("msSource"), "onchange", null, "updateSource");
Setting Default Field Values

The default value of a particular field can be set - $default<fieldVelocityName> - for any field (if applicable), before calling the submitContentEdit macro. ***Special Note***, the first letter of the velocity variable name needs to be capitalized regardless of how it appears on the Content Type. So if the variable name of the field is "answer" then the example below is how you would set a default value by capitalizing the first letter of the velocity variable name:

Ex: #set($defaultAnswer="yes")
Macro Overview:


#submitContentEdit("Content Identifier")


  • Content Identifier
    This is the identifier the contentlet that will be editable from a Front-end form.


  • contentFormReferer (velocity variable- not a parameter)
    Optional: redirects the user to the specified relative path after form submission. For example: '/forms/'
    Default: If this variable is not set, then after form submission, the submitContentEdit macro form returns the Front-end user to the same form page by default with "content saved" messaging inserted at the top of the form.
  • contentAutoPublish (velocity variable- not a parameter)
    Optional: If set to true, the changes to the edited content will automatically published upon save.
    Default: false
  • contentUseCaptcha (velocity variable not a parameter)
    Optional: If set to "true", the form will display a captcha image to the edit content form, to validate human interaction
    Default: false
  • contentUseAudioCaptcha (velocity variable- not a parameter)
    Optional: If set to "true" shows a audio captcha to the content's form, to validate human interaction
    Default: false
  • contentUseAudioCaptchaHeight (velocity variable not a parameter)
    Optional: If 'contentUseAudioCaptcha' var is set to "true", the height of the audio player used will be:
    Default: 30
  • contentModeration (velocity variable- not a parameter)
    Optional: If set, that will be the ROLE KEY of the role to assign the workflow
  • showOnlyRequiredFields (velocity variable- not a parameter)
    Optional: If set to "true" shows only the required fields from the contentlet being edited
    Default: false
  • dontShowFields (velocity variable- not a parameter)
    Optional: If set, the comma separated list of velocity variable names set cause the corresponding content fields to be hidden from the edit content form. For example:
    #set($dontShowFields= "description, photo")
  • default<velocity field name> (velocity variable not a parameter)
    If the Webmaster wants to use a different default value for a particular field, could add a default variable
    For example, to change the default value for a field called "Summary" on the Content Type, the variable could be:
    #set($defaultSummary= "Test Summary")
  • <relationship_name> (velocity variable not a parameter)
    If the Content Type has a required relationship, the Webmaster must set an array variable with the relationship name and the identifier(s) of the corresponding contentlet(s) that should be related to the form edited contentlet upon save.
    For example: if a required relationship between News and Comments Content Types exists, the Webmaster should add a variable like this
       #set($News_Comments= ["12345","67890"])
    The values in the comma separated list must be the identifiers of the contentlets to be related to the content being edited in the Front-end form. If any of the content identifiers are invalid, the relationship(s) will not be saved. Non-requiered relationships may also be set in the same way.
  • dateCalendarCSS (velocity variable- not a parameter)
    Optional: This variable can be used to set the custom style sheet for the calendar popup provided by date fields.
  • contentFormMacroCSS (velocity variable- not a parameter)
    Optional: This variable can be used to set the custom style sheet to over-ride the default dojo classes being used on all form fields.
  • errorMessagesPath (velocity variable- not a parameter)
    Optional: Sets the path to a custom page that will display the error/success message handling for the form. The default page is set to static/messages.html.


Use this macro to edit an existing piece of content from a Front-end form.

Example 1: A simple example using the required fields

This example allows for the editing of an existing piece of news content and forwards user to the news index page on submit.

#set($contentFormReferer = "/news/")


Example 2: An example using more of the optional parameters

Editing: image captcha validation, a workflow task, modify the default value for the title field, and relating two comment contentlets on a required relationship.

#set($contentUseCaptcha = true)

#set($contentModeration= "reportuser")

#set($defaultTitle = "TEST TITLE")

#set($News-Comments = ["321229","321231"])


Example 3: An example showing how to include additional parameters

This example allows the editing of existing content from a form with: audio captcha validation, content auto publish, showing only the required fields, hiding the info, test and photo fields- and modifying the default description field value.  A velocity variable being passed to the macro.

#set($contentUseCaptcha = true)

#set($contentUseAudioCaptcha = true)

#set($contentAutoPublish = true)

#set($showOnlyRequiredFields = true)

#set($dontShowFields = "info, test, photo")

#set($defaultDescription = "TEST Description")


On this page