Date Validation in R5

We have a date field in a layout region and would like to restrict only date values to be entered and not any other characters. it allows any character to be typed in the field, but performs its own built-in validation and displays 'Unable interpret time/date value'. we want to trap that and display our message. we have tried input validation, field exiting event etc. If we set the initial value of the date field as "" when calling the dialogbox, the error message appears. if we set a date as the initial value, the initial date is taken as the value for that field, even though we type some characters into it.
How to validate this date field with our error message?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use the field's exiting and entering events
Put the below Lotus script code into that can go into the field's exiting event, the field need not be of type time:

       Dim ws As New notesuiworkspace
       Dim uid As notesuidocument
       Set uid = ws.currentdocument
       dtxt = uid.fieldgettext("date_field_name")
       If dtxt <> "" Then                
          If Not Isdate(dtxt) Then
          Messagebox "Please enter a valid date"
          Call uid.gotofield("date_field_name")
            Call uid.fieldsettext("date_field_name",Str(Cdat(dtxt)))
          End If
       End If

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
iswgAuthor Commented:

 we have tried the exiting script also. the field has to be a date field only because we are using the native OS style type (with the calender dates). does this code depend upon the initial value we are giving to this field? How to make this work when we give "" as the initial value to this field?
What about just leave the initial value blank, ie no need to put anything, not even "", just blank.
Cool ISWG !

I am back to Form !  :)

Use !@IsDate Function to check for the content and @Failure or @Return to give you proper error message !

This will suppress the notes internal message

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.