Disable specific dates and a certain day of the week

Hello i use the script from documentation to disable specific dates and a certain day of the week

here https://docs.gravityforms.com/gform_datepicker_options_pre_init/#7-disable-specific-dates-and-a-certain-day-of-the-week

but the user can manually write the date I have made disable in the calendar field without choosing from the calendar icon picker

how can i disable this?

I’ve seen the following snippet used to disable direct input of the date when datepicker is available – requiring users select from the datepicker. Note: Unsure what effect this may have on accessibility.

// Disable direct date input when datepicker is active
add_filter( 'gform_field_content', function ( $content, $field, $value, $lead_id, $form_id ) {

    if ( $field instanceof GF_Field_Date && $field->dateType == 'datepicker' ) {

        $content = str_replace( "class='datepicker", "onfocus='blur();' class='datepicker" , $content );

    }

    return $content;

}, 10, 5 );
1 Like

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