Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 7 of 7 total
Thread Validating a date input
Thu, May 14 2015 2:13 PMPermanent Link

Uli Becker

After some time of searching I need help:

how can I check if an input (edit field) contains a valid date? (Without
using a DatePicker).

Thanks.

Uli
Thu, May 14 2015 2:40 PMPermanent Link

Uli Becker

I found a script that works fine here:

http://www.the-art-of-web.com/javascript/validate-date/

Uli

Fri, May 15 2015 9:39 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< how can I check if an input (edit field) contains a valid date? (Without
using a DatePicker). >>

In EWB 2, you have these in the WebCore unit:

  function IsDate(const Value: String): Boolean;
  function IsTime(const Value: String): Boolean;
  function IsDateTime(const Value: String): Boolean;

But, they are simply just try..except wrappers around the StrToDate,
StrToTime, etc. functions, so they'll work just as well with EWB 1.

Tim Young
Elevate Software
www.elevatesoft.com
Fri, May 15 2015 11:56 AMPermanent Link

Uli Becker

Tim,

> In EWB 2, you have these in the WebCore unit:
>
>    function IsDate(const Value: String): Boolean;
>
> But, they are simply just try..except wrappers around the StrToDate,
> StrToTime, etc. functions, so they'll work just as well with EWB 1.

I tried StrToDate in a try...except block with no success. And:

   if isDate('Elevatesoft') then
      showmessage('isDate = true')
   else
      showmessage('isDate = false');

results in "isDate = true"!

Uli
Fri, May 15 2015 12:54 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Uli,

<< I tried StrToDate in a try...except block with no success. And:

   if isDate('Elevatesoft') then
      showmessage('isDate = true')
   else
      showmessage('isDate = false');

results in "isDate = true"! >>

Yeah, they're missing some exceptions that I thought were in there. Frown
I'll add them now.

Tim Young
Elevate Software
www.elevatesoft.com


Fri, May 15 2015 1:12 PMPermanent Link

Raul

Team Elevate Team Elevate

<<
Uli Becker wrote:
   if isDate('Elevatesoft') then
      showmessage('isDate = true')
   else
      showmessage('isDate = false');

results in "isDate = true"!
>>


Result is correct in philosophical sense in that this is the start of new era in JS development Smile(i.e. day "-5" or whatever is left til release of ewb2)

Raul
Fri, May 15 2015 1:27 PMPermanent Link

Uli Becker

Raul,

> Result is correct in philosophical sense in that this is the start of new era in JS development Smile(i.e. day "-5" or whatever is left til release of ewb2)

<vbg>

Uli
Image