Last active
December 29, 2015 03:29
-
-
Save stevewithington/7608076 to your computer and use it in GitHub Desktop.
Mura CMS : how to add jQuery UI datepicker to a form field.
This file contains hidden or 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
<cfoutput> | |
<!--- place this snippet wherever you want your form to show up ---> | |
#$.dspThemeInclude('display_objects/sample_form.cfm')# | |
</cfoutput> |
This file contains hidden or 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
<!--- 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 file contains hidden or 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
<!--- 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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where would you apply code to set a min date parameter?
$("input.calendar").datepicker({
minDate: 0
});
Not sure where this code would go....