Forked from modmedia/muraCreateContentNodeFromForm.cfm
Created
April 11, 2014 01:00
-
-
Save ronnieduke/10435247 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--- 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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this code still usable in Mura 7? If not, could someone ad a Mura 7 code example?
Thanks.