Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ronnieduke/10435247 to your computer and use it in GitHub Desktop.
Save ronnieduke/10435247 to your computer and use it in GitHub Desktop.
<!--- Drop this into your site eventhandler.cfc --->
<cffunction name="onAfterFormSubmitSave" output="true">
<cfif $.event('formid') EQ '{ID of the Mura form}'>
<!--- Get the form result --->
<cfset formBean = $.event().getValue('formresult')>
<!--- Get a new content bean --->
<cfset cBean = application.contentManager.getBean()>
<!--- Set the new node attributes --->
<cfset cBean.setSiteID($.event('siteid'))>
<cfset cBean.setType('Page')>
<cfset cBean.setSubType('mySubtype')>
<cfset cBean.setTitle(formBean.TITLE)>
<!--- Set any extended attributes --->
<cfset cBean.setExtAttribute1(formBean.VALUE1)>
<cfset cBean.setExtAttribute2(formBean.VALUE2)>
<!--- if your form has a file in it, set it as the associated image --->
<cfset cBean.setFileID(formBean.FILE_ATTACHMENT)>
<!--- Set the content ID of where you want this new node to live under --->
<cfset cBean.setParentID('{content ID}')>
<!--- Set whether it's displayed, approved, nav, etc --->
<cfset cBean.setApproved(1)>
<cfset cBean.setDisplay(1)>
<cfset cBean.save()>
</cfif>
</cffunction>
@MvdO79
Copy link

MvdO79 commented Jan 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment