Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author ovann86

    (@ovann86)

    Hey Herbert,

    I’m not familiar with the weeknumber option, can you share how you configured the datepicker to use it so I can do some testing?

    Thread Starter herbert

    (@herbie4)

    @ovann86 sorry for the late response…
    I used this:

    <script>
    		gform.addFilter( 'gform_datepicker_options_pre_init', function( optionsObj, formId, fieldId ) {
    			optionsObj.firstDay = 1;
    
    			if ( formId == 1 ) {
    				optionsObj.onClose= function (dateText, inst) {
    					jQuery(this).val(jQuery.datepicker.iso8601Week(jQuery(this).datepicker("getDate")));
    				}
    			}
    			return optionsObj;
    		});
        </script>

    It is working perfectly. Only problem is that the form won’t validate on submission.

    Plugin Author ovann86

    (@ovann86)

    Hey,

    I see what you mean.

    I also see the standard Gravity Forms date field has the same issue with validating.

    I’ll have a think about how to best fix this up and will let you know the outcome.

    Thread Starter herbert

    (@herbie4)

    Thank you! ??

    Plugin Author ovann86

    (@ovann86)

    Hey Herbert –

    After giving this some thought I think the best approach is to create another filter that allows you to disable the validation on a per form/field/column basis.

    I’ll be releasing an update shortly that’ll include this filter.

    Example usage:

    add_filter( 'itsg_list_field_datepicker_disable_validation', 'itsg_disable_validation', 10, 4 );
    function itsg_disable_validation( $default, $form_id, $field_id, $column_number ) {
    	if ( 43 == $form_id && 31 == $field_id && 1 == $column_number ) {
    		return true;
    	}
    }
    Thread Starter herbert

    (@herbie4)

    @ovann86 -> Okay that sounds great. I will wait for your release.
    Thank you.

    Thread Starter herbert

    (@herbie4)

    It is working perfectly! Thank you ovann86

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘change or disable date validation’ is closed to new replies.