How to make the field to book 7 days later.

Home Forums Quform WordPress How to make the field to book 7 days later.

This topic is: not resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #14840
    shockmedia
    Participant

    Hi I somehow manage to make the datepicker to book 7 days later.
    Unfortunately it doesn’t work for the fieldpicker but only the calendar.

    Is there any PHP code we can use for that function?

    Thanks!

    #14847
    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.

    #14910
    shockmedia
    Participant

    function mytheme_prevent_past_dates($valid, $value, $element)
    {
    $time = strtotime("{$value['year']}-{$value['month']}-{$value['day']}");

    if ($time < strtotime('today')) {
    $element->addError('Please choose a date in the future');
    $valid = false;
    }

    return $valid;
    }
    add_filter('iphorm_element_valid_iphorm_2_4', 'mytheme_prevent_past_dates', 10, 3);

    function mytheme_datepicker_prevent_past_dates($options, $dpMinYear, $dpMaxYear, $element)
    {
    $year = date('Y'); // Today's year
    $month = date('n'); // Today's month
    $day = date('j') +7; // Today's day

    return "{
    minDate: new Date({$year}, {$month} - 1, {$day} ),
    maxDate: new Date({$dpMaxYear}, 12 - 1, 31)
    }";
    }
    add_filter('iphorm_datepicker_options_iphorm_2_4', 'mytheme_datepicker_prevent_past_dates', 10, 4);

    #14926
    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 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2025 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy