brianrowe
2/26/2015 - 1:39 PM

muraCreateContentNodeFromForm.cfm

<!--- 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>