Validating Event End Time - not before Event Start Time
Hi all,
I'm trying to implement validation of two select lists - one contains the start time of an event and one contains the end time.
Using Server Side Validations I want to check that the end time entered isnt before the start time. Sounds simple enough using the min feature of the Time Validation right?
Unfortunately I can't get it to work.
<?php
if (isset($_POST["BT_Insert_x"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_eventnewdates_622_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateDT(((isset($_POST["eventdate"]))?$_POST["eventdate"]:"") . "",true,"\b([12]\d|3[0-1]|0[1-9])\/(1[0-2]|0[1-9])\/\d{4}\b","","",false,".*","","",true,1);
$WAFV_Errors .= WAValidateDT(((isset($_POST["start"]))?$_POST["start"]:"") . "",true,".*","","",true,"\b(1\d|2[0-3]|0?\d):[0-5]\d(:[0-5]\d)?\b","","",true,2);
$WAFV_Errors .= WAValidateDT(((isset($_POST["end"]))?$_POST["end"]:"") . "",false,".*","","",true,"\b(1\d|2[0-3]|0?\d):[0-5]\d(:[0-5]\d)?\b","".$_POST["start"] ."","",true,3);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"eventnewdates_622");
}
}
?>
It only seems to validate the second part of the time, which increments in 15 minute intervals. So if the event starts at 9:30 then 10:15 would fail validation however 10:45 would pass, 11:00 would fail but 11:45 would pass.
Am I missing something really obvious here?
Both select lists for the start and end times are formatted the same:
<option value="08:00:00" <?php if (!(strcmp("08:00:00", (ValidatedField("eventnewdates_622","start"))))) {echo "selected=\"selected\"";} ?>>08:00</option>
<option value="08:15:00" <?php if (!(strcmp("08:15:00", (ValidatedField("eventnewdates_622","start"))))) {echo "selected=\"selected\"";} ?>>08:15</option>
<option value="08:30:00" <?php if (!(strcmp("08:30:00", (ValidatedField("eventnewdates_622","start"))))) {echo "selected=\"selected\"";} ?>>08:30</option>
Any help would be much appreciated.
Cheers
Ian