Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Last active December 29, 2015 03:29
Show Gist options
  • Save stevewithington/7608076 to your computer and use it in GitHub Desktop.
Save stevewithington/7608076 to your computer and use it in GitHub Desktop.
Mura CMS : how to add jQuery UI datepicker to a form field.
<cfoutput>
<!--- place this snippet wherever you want your form to show up --->
#$.dspThemeInclude('display_objects/sample_form.cfm')#
</cfoutput>
<!--- This file should be placed under /{SiteID}/includes/themes/{themeName}/display_objects/htmlhead/jquery_ui.cfm --->
<cfoutput>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
jQuery(document).ready(function($) {
// this will apply the datepicker to any input that contains a class of 'calendar'
$('input[class*="calendar"]').datepicker();
});
</script>
</cfoutput>
<!--- This is just an example form. It can be placed under /{SiteID}/includes/themes/{themeName}/display_objects/sample_form.cfm --->
<cfoutput>
<!--- This line of code will add the jquery_ui.cfm file we created before the closing head tag --->
#$.addToHTMLHeadQueue('#$.siteConfig('themeAssetPath')#/display_objects/htmlhead/jquery_ui.cfm')#
<!--- Your Form Goes Here --->
<form name="yourFormName">
<!--- Remember, the jQuery we wrote will look for any input that contains a class of 'calendar' --->
<input type="text" name="YourDate1" class="calendar" />
<br /><br />
<input type="text" name="YourDate2" class="calendar" />
</form>
</cfoutput>
@richleach
Copy link

Where would you apply code to set a min date parameter?
$("input.calendar").datepicker({
minDate: 0
});

Not sure where this code would go....

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