please help prevent past and current date from being chosen

Home Forums Quform WordPress please help prevent past and current date from being chosen

This topic is: resolved

This topic contains 6 replies, has 2 voices, and was last updated by  Ally 8 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #23734

    joeblow44444444
    Participant

    hi all, please help me with a solution to prevent the current date from being chosen. note: not a specific date; whatever the current date is.

    i am not a code guru, please explain to me as if i’m a foreign child with step by step extremely specific instructions, the documentation does not provide this.

    i found this:

    
    (function() {
        $( "#datepicker" ).datepicker({ minDate: 1});
      });
    

    which works in jsfiddle but i don’t know where to put it or how to make my forms see it. everything i’ve tried either throws an error or is simply ignored by the forms.

    #23735

    joeblow44444444
    Participant

    i did see this in the documentation but don’t understand what i’m supposed to do with the extra numbers such as 10, 4

    function my_datepicker_prevent_past_dates($options, $dpMinYear, $dpMaxYear, $element)
    {
        return "{
            minDate: 0,
            maxDate: new Date({$dpMaxYear}, 12 - 1, 31)
        }";
    }
    add_filter('iphorm_datepicker_options_iphorm_1_1', 'my_datepicker_prevent_past_dates', 10, 4);
    
    #23792

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #23814

    joeblow44444444
    Participant

    As it turns out, the reason I couldn’t find the solution was because I have version 2 but for whatever reason the documentation only refers to version 1. I eventually found the version 2 method you noted above, but wasted a lot of time to do so.

    #23825

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #23867

    joeblow44444444
    Participant

    what about for multiple forms?

    #23926

    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.