Home » Developer & Programmer » Forms » how to validate date (forms6i,winxp)
how to validate date [message #312299] Tue, 08 April 2008 08:17 Go to next message
Messages: 2
Registered: April 2008
Junior Member
hi all ,
Am doing a project which is having some validations
Let me explain
Am having a canvas(main)in whis i kept two texy fields date of birth and date of join in which i had kept code for key next instance for date of birth

if(:main.dt_of_birth> sysdate) then
message('INVALID DATE');
message('INVALID DATE');
end if;

and now for date of join i wanna accept only only the ppl whose age is greater than 18 from date of birth so i wanna code for that
please can u send me the code
Re: how to validate date [message #312308 is a reply to message #312299] Tue, 08 April 2008 08:57 Go to previous messageGo to next message
Messages: 48
Registered: March 2008
Location: Mexico
Hi Rocky:
Look you don't have to code it at all because forms can do it for you.
Use the $$DATE$$ system variable, this is what Forms Help sais about it:


$$DATE$$ retrieves the current operating system date (client-side). Use $$DATE$$ to designate a default value or range for a text item using the Initial Value or Lowest/Highest Allowed Value properties. The text item must be of the CHAR, DATE, or DATETIME data type.
Use $$DATE$$ as a default value for form parameters. In this case, the parameter's value is computed once, at form startup.

So just set the highest value allowed to $$date$$ and that's it. And don't code it in the Key-Next-Item because what would happen if the user never hits Enter or Tab? Then your validation would never be fired.

Re: how to validate date [message #312389 is a reply to message #312299] Tue, 08 April 2008 13:51 Go to previous message
Messages: 21012
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
There was a recent discussion about restricting date values using the "Highest Allowed Value"; search for it (or, if you don't want to, it will come to what Solisdeveloper said: there's no need to code such an event).

As of "18 years of age" problem, here's how to compute a date which was exactly 18 years ago:
SQL> SELECT ADD_MONTHS(SYSDATE, -12*18) eighteen_years_ago FROM dual;

08.04.1990 20:47:15

Which would mean that date of birth must be BEFORE this value in order to accept it.
Previous Topic: Get_item_property LOV_NAME return FRM-40738 error
Next Topic: setting icon path
Goto Forum:

Current Time: Sun Feb 19 13:01:07 CST 2017

Total time taken to generate the page: 0.10366 seconds