close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Validating Event End Time - not before Event Start Time

Thread began 6/09/2011 2:04 am by iansheldon422428 | Last modified 6/14/2011 8:42 am by Jason Byrnes | 2682 views | 6 replies |

iansheldon422428

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

Sign in to reply to this post

Jason ByrnesWebAssist

since your times are all passing 00 for the seconds:
08:00:00

why not use the 14:38 format instead of the 14:38[:18] format, and set the list values to only pass hour and minutes instead of hours minutes seconds.
08:00

Sign in to reply to this post

iansheldon422428

Hi Jason,

Thanks for the reply.

I will give it a go. I think I tried that originally but the data would not insert into the SQL time field.

I will update shortly....

Cheers
Ian

Sign in to reply to this post

Jason ByrnesWebAssist

If run into other problems, please attach a copy of the page compressed into a zip file so I can see the code in context and also test it on my end.

Sign in to reply to this post

iansheldon422428

Hi Jason,

I get the same issue if I remove the trailing :00 from the time in the select list and change the Server Behaviour to reflect that.

It will only validate if the minute value of the end time is greater than the minute value of the start time - so if the event starts at 9:30 it thinks that 12:15 is an invalid finish time.

Any light you could shed on this would be great.

Cheers
Ian

Attached Files
event-new-dates.zip
Sign in to reply to this post

iansheldon422428

Morning Jason,

Just wondering if you have had chance to look at this one yet?

Cheers
Ian

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

If anyone else is experiencing this same issue, please append to this thread.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...