Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Last active April 27, 2018 19:17
Show Gist options
  • Save stevewithington/6c9d37fb02cb724d03ba to your computer and use it in GitHub Desktop.
Save stevewithington/6c9d37fb02cb724d03ba to your computer and use it in GitHub Desktop.
Mura CMS : Example of how to use one of Mura's Content Tab Events to display a Custom UI field.
<!---
Place this method in your Site, Theme, or Plugin's eventHandler.cfc
See http://docs.getmura.com/v6/back-end/events/content-tab-events/ for more Content Tab Events
--->
<cffunction name="onContentTabBasicTopRender">
<cfset var local = {} />
<!--- This assumes you've created some extended attributes to account for each custom form field --->
<cfsavecontent variable="local.str">
<div class="fieldset">
<div class="form-group control-group">
<label for="myCustomFormField" class="control-label">My Custom Form Field</label>
<input type="text" name="myCustomFormField" class="form-control" />
</div>
</div>
<script>
jQuery(document).ready(function($) {
var myTags = [
'JavaScript'
,'Java'
,'CFML'
,'ColdFusion'
,'Mura'
,'CMS'
];
// prompt users as they type
$('input[name="myCustomFormField"]').autocomplete({source: myTags});
});
</script>
</cfsavecontent>
<cfreturn local.str />
</cffunction>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment