Re: Forms 4.0 date

From: Tommy Wareing <p0070621_at_brookes.ac.uk>
Date: Fri, 07 Aug 1998 09:02:54 GMT
Message-ID: <35cabf58.83675418_at_news.brookes.ac.uk>


On 5 Aug 1998 15:22:51 GMT, stevec_at_zimmer.csufresno.edu (Steve Cosner) wrote:

>In article <ZXz9VCAiuzw1IwHs_at_tcamiga.demon.co.uk>,
>Andrew Hodgson <hodge_at_tcamiga.demon.co.uk> wrote:
>>I have a date field in Forms 4.0, I want my users to be able to enter a
>>date or a date time value in this field. Is it possible to get this set
>>up so that when a user enters a date only, the time doesn't need to be
>>entered.
>>
>>EG 12-jan-1998 instead of 12-jan-1998 0:0:0 which we have to enter
>>at present.
>>
>>I'd like to avoid using any complex string processing here, Is there
>>anything built in to the forms package ?
>
>Complex string processing is your answer. There is nothing set up for
>you in forms.

In forms 3, we put a format mask of DD-MON-YYYY on all our date fields. Of course, the users then proceeded to enter 7-AUG-98 (which becomes 98 AD, not 1998 AD). To fix this we added an on-validate-field trigger to push the date to the current century if necessary (or into the next century if the entered year was less than 10).

But, under forms 4, we suddenly found that it was not possible to enter the year 0. Technically, this is correct: there was no such year, but it was a major annoyance: our users had got used to being able to type 7-AUG-00 and seeing it change to 7-AUG-2000. The problem was that the built in forms validation was objecting before our on-validate-field trigger (now on-validate-text-item) fired.

Anyway, the fix is:
pre-text-item trigger to disable validatation (using set_form_property)
post-text-item trigger to renable validation :-) and then do whatever validation you require (using NAME_IN to get the current string in the field).

So now we've actually got *better* validation than Oracle provided: our current arrangment will accept:
DD-MON-YY
DD-MON-YYYY
MON-YYYY

DD-MON
DD-MM
DD-MM-YYYY
DD-MM-YY
MM-YY

etc.
And year 0!

--
Tommy Wareing
MIS Group
Learning Resources
Oxford Brookes University
01865 483389
Received on Fri Aug 07 1998 - 11:02:54 CEST

Original text of this message