Last active
January 5, 2016 14:37
-
-
Save pauldenato/8edd8bd283647666c595 to your computer and use it in GitHub Desktop.
Loop the Files in a mura form
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
<!---Add to Site or Theme eventhandler.cfc---> | |
<cffunction name="onAfterFormSubmitSave"> | |
<cfargument name="$"> | |
<cfset var msg = "" /> | |
<!---Get Most Recent Form ID---> | |
<cfset receipt = $.event('formDataBean').getFormResult() /> | |
<!---Load Form Data---> | |
<cfset record = receipt /> | |
<!---Image Count for Uploads---> | |
<!---Set Image Count for Your Form Values---> | |
<cfset imagesToAdd = "1,2,3,4,5" > | |
<cfsavecontent variable="msg"> | |
<cfoutput> | |
<cfloop list="#imagesToAdd#" index="i"> | |
<!---"file" would be replaced by you fomr field name ---> | |
<cfset theImage = "file#i#_attachment" /> | |
<cfif len(trim(receipt.responseid))> | |
<cfif structKeyExists(record,theImage) and Len(HTMLEditFormat(record[theImage]))> | |
<div style="padding-left: 0px;" class="col-md-3 col-sm-3"> | |
<a class="" title="#record[theImage]#" href="http://#CGI.HOST#/#$.globalConfig('context')#tasks/render/file/?fileid=#record[theImage]#"> | |
#theImage# | |
</a> | |
</div> | |
<cfelse> | |
<div style="width: 80px; height: 80px; font-size:.9em;margin-right: 15px;" class="alert alert-danger col-md-3 col-sm-3">N/A Image #i#</div> | |
</cfif> | |
</cfif> | |
</cfloop> | |
</cfoutput> | |
</cfsavecontent> | |
<!---Just a test email to see if the file values submitted---> | |
<cfmail to="{email here}" from="{email here}" subject="#$.event('formbean').getValue('title')# receipt Email" type="html"> | |
#msg# | |
</cfmail> | |
</cffunction> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment