[list=]from_date must be not before today
end_date must be after from_date[/list]
As per http://www.chronoengine.com/faqs/70-cfv5/5216-date-control-using-cfv5-date-picker-element.html Using the extra parameters box I can use The following"data-start_date=<?php echo date("d-m-Y"); ?>" Though it doesn't work if I instead use the advanced tab and put "<?php echo date("d-m-Y"); ?>" In the start date box??
But to do part 2 doesn't seem possible.
I then tried to follow the advice at https://www.chronoengine.com/faqs/64-cfv4/cfv4-using-the-datepicker/3161-how-can-i-select-a-range-of-dates-part-2.html, but the page just fails to load. Some debugging has tied this to the MooTools Custom code (page loads if I delete it but leave JS code in).
What am I doing wrong?
I have both C4 & C5 currently installed as I can't remove C4 until I can port the forms onto C5.
For info I previously did all the checking with a C4 custom server side validation using the code below, but this won't work on C5 as you have set validation 'things'. BTW the code below was cobbled and robbed from various FAQs so please don't assume much PHP knowledge when replying 😉
<?php
$error_count = 0;
$f_date = $form->data['from_date'];
$t_date = $form->data['end_date'];
$todays_date = date("Y-m-d");
$today = strtotime($todays_date);
$from_date = strtotime($f_date);
$to_date = strtotime($t_date);
if (($from_date > $today) && ($to_date > $today)) {
if ($to_date < $from_date) {
$error_count++;
$form->validation_errors['to_date'] = "Leaving before you arrive.";
}
} else {
$error_count++;
$form->validation_errors['end_date'] = "Date in the past.";
$form->validation_errors['from_date'] = "Date in the past.";
}
$db =& JFactory::getDBO();
$query = "
SELECT `latestdate`
FROM `#__chronoforms_data_HutBookingLimit`
WHERE `cf_uid` = '90e7227465f69bf8ec01acc5f8c17c52' ;
";
$db->setQuery($query);
$d = $db->loadResult();
$F_date = strtotime( $d );
if($from_date > $F_date)
{
$error_count++;
$Final_date = date( "F j, Y", strtotime( $d ) );
$form->validation_errors['from_date'] = "We can not yet accept bookings after " . $Final_date. ".";}
if ( $error_count ) {
return false;
}
?>