2 Replies Latest reply on Feb 27, 2013 10:30 AM by MichielEilbracht

    IsValid() on date entry issue

    MichielEilbracht

      Title

      IsValid() on date entry issue

      Post

           Hi all,

           I just needed a quick way to validate a date entry using a Custom Dialog, so I used IsValid ( date_field ) in a script...

           Funny enough, when I enter "31-12-201" it returns 1 (validated).

           Of course the year 201 is a valid year...but not what I want...is there a way to limit this to, say, from 1900 and so on, or do I need to make a custom function? Normally I validate dates using the table settings, etc, but I just came accross this...

           Thanks!

           Michiel

        • 1. Re: IsValid() on date entry issue
          philmodjunk

               Since you are already using a script, you don't need a custom function, but such could be used.

               Here's a script that could check to see if the date is greater than a specified minimum acceptable value:

               If [ IsValid ( YourTable::DateField ) and YourTable::DateFIeld > Date ( 1 ; 1 ; 1950 ) // use whatever date best works for this here ]
                  # Do whatever you need to do if the date is valid here
               Else
                 # Do whatever you need to do if the date is invalid here
               End If

          • 2. Re: IsValid() on date entry issue
            MichielEilbracht

                 Hey PhilModJunk...

                 pff...I should have known it was that simple...

                 Thanks a bunch!