Home › Forums › Quform WordPress › How to make the field to book 7 days later.
- This topic has 3 replies, 2 voices, and was last updated 10 years, 5 months ago by
Ally.
- AuthorPosts
- April 2, 2015 at 7:15 am #14840
shockmedia
ParticipantHi 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!
April 2, 2015 at 10:39 am #14847Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
April 10, 2015 at 7:28 am #14910shockmedia
Participantfunction 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 dayreturn "{
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);April 11, 2015 at 1:57 pm #14926Ally
Support StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.