Created
August 15, 2017 18:28
-
-
Save brycejacobson/94183df9913fe5684c246db8e9154639 to your computer and use it in GitHub Desktop.
Gravity Forms Restrict Date Picker Date Range
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
<script type="text/javascript"> | |
// Add the following to an HTML block on your form | |
gform.addFilter( 'gform_datepicker_options_pre_init', function( optionsObj, formId, fieldId ) { | |
if ( formId == 7 && fieldId == 220, 226, 243, 282, 290, 298, 348, 356, 364, 414, 422, 430 ) { | |
optionsObj.minDate = '+2'; // No letter for days | |
optionsObj.maxDate = '+1 Y'; // M for month, Y for years | |
} | |
return optionsObj; | |
} ); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment