>- see footer for list info -<
you may get weird results in the future from converting dates (like now())
to strings using dateformat or lsdateformat and then doing date functions on
them.

most of the time it will work but it is always best to only do date
functions on date objects then format to a string for output.

that is why I suggested lsparsedate which will return a valid date object
from your form variable.  and you can use now() directly in the dateCompare.

Just a warning - it has bitten me in the past. :-)



On 3/23/06, Paul Swingewood <[EMAIL PROTECTED]> wrote:
>
> >- see footer for list info -<
> Cracked it ...!
>
> Just needed a little sleep I think .....
>
> <!--- Validate the form fields in case JavaScript validation failed. --->
> <cfscript>
>    // Initialize variables;
>    ErrorMessage = "";
>          Todays_Date = lsdateformat(now(), "dd/mm/yyyy");
>
>
>          //Check the Incident date delimeters.
>          //if there aren't exactly 3 elements in this list assuming the
> delimiter
> is "/", it fails
>          IF (NOT ListLen(IncidentDate, "/") EQ 3){
>       ErrorMessage = ErrorMessage & "The Incident Date has an invalid
> delimeter. - dd/mm/yyyy<br>";
>    }
>
>    // IncidentDate.
>    if (NOT Len(Trim(IncidentDate)) OR NOT IsDate(IncidentDate)) {
>       ErrorMessage = ErrorMessage & "The Incident date is invalid. -
> dd/mm/yyyy<br>";
>    }
>
>          // The incident can't be in the future.
>
>    if (IsDate(IncidentDate) AND DateCompare(IncidentDate, Todays_Date) EQ
> 1)
> {
>       ErrorMessage = ErrorMessage & "You can not record an incident in the
> future!.<br>";
>    }
>
> </cfscript>
>
>
> _______________________________________________
>
> For details on ALL mailing lists and for joining or leaving lists, go to
> http://list.cfdeveloper.co.uk/mailman/listinfo
>
> --
> CFDeveloper Sponsors:-
> >- Hosting provided by www.cfmxhosting.co.uk -<
> >- Forum provided by www.fusetalk.com -<
> >- DHTML Menus provided by www.APYCOM.com -<
> >- Lists hosted by www.Gradwell.com -<
> >- CFdeveloper is run by Russ Michaels, feel free to volunteer your help
> -<
>



--
Mike T
Blog http://www.socialpoints.com/
_______________________________________________

For details on ALL mailing lists and for joining or leaving lists, go to 
http://list.cfdeveloper.co.uk/mailman/listinfo

--
CFDeveloper Sponsors:-
>- Hosting provided by www.cfmxhosting.co.uk -<
>- Forum provided by www.fusetalk.com -<
>- DHTML Menus provided by www.APYCOM.com -<
>- Lists hosted by www.Gradwell.com -<
>- CFdeveloper is run by Russ Michaels, feel free to volunteer your help -<

Reply via email to