Add.filter Syntax Error

Hi Gravity Forum,

If i use any add.filter like

gform.addFilter( 'gform_datepicker_options_pre_init', function( optionsObj, formId, fieldId ) {
    if ( formId == 12 && fieldId == 8 ) {
        optionsObj.minDate = 0;
        optionsObj.onClose = function (dateText, inst) {
             jQuery('#input_12_9').datepicker('option', 'minDate', dateText).datepicker('setDate', dateText);
        };
    }
    return optionsObj;
});

Wordpress tells me that “syntax error, unexpected token “;”, expecting “)””

What is my problem?

Hi Nikolas,

What you have there is a JavaScript code snippet and not PHP, so it doesn’t go into the function.php file. You can use this free custom Javascript plugin by Gravity Wiz to add the snippet to your form.

Best,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.