Disabled Past Date not working

I put this code on my header but it seems it is not working.

http://businessedgeservices.flywheelsites.com/
user: flywheel
pass: attractive-scarecrow
gform.addFilter( ‘gform_datepicker_options_pre_init’, function( optionsObj, formId, fieldId ) {
// Apply to field 2 only
if ( fieldId == 6 ) {
optionsObj.minDate = 0;
}
return optionsObj;
});

Replace your code with below code, Your code can be placed in a HTML field on your form or in a theme custom JavaScript file.

<script>
jQuery(document).ready(function () {
	gform.addFilter(‘gform_datepicker_options_pre_init’, function (optionsObj, formId, fieldId) {
		// Apply to form id 1 and field 6
		if (formId == 1 && fieldId == 6) {
			optionsObj.minDate = 0;
		}
		return optionsObj;
	});
});
</script>
1 Like

thank you for the quick response however, Still not working. Please check

The quotes around gform_datepicker_options_pre_init need to be straight. In your code, and sometimes in this forum, they get changes to ‘fancy quotes’. If you change these, your code should work fine. Right now, it’s throwing a syntax error on those characters.