Home » Developer & Programmer » Forms » WHEN-VALIDATE-ITEM does not work! Help!!
WHEN-VALIDATE-ITEM does not work! Help!! [message #164447] Thu, 23 March 2006 08:52 Go to next message
sephina
Messages: 14
Registered: March 2006
Junior Member
Hi. I'm trying to use a When-validate-item trigger to restrict the value entered in the "date" field. I am making a system to sell DVD's and the "release date" entered should not be greater than the current date. I have tried the below coding and there are no errors but the statement does not bring up the error message when I try to enter a DVD with the wrong release date. Please could somebody help me out urgently with this.

if :release_date > current_date
then Message('Please Enter A Valid Date');
end if;


Thanks
Sephina
Re: WHEN-VALIDATE-ITEM does not work! Help!! [message #164462 is a reply to message #164447] Thu, 23 March 2006 09:33 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Create an alert and use the show_alert built-in. After the alert you enter the RAISE_FORM_TRIGGER_FAILURE command.

MHE
Re: WHEN-VALIDATE-ITEM does not work! Help!! [message #164472 is a reply to message #164462] Thu, 23 March 2006 10:00 Go to previous messageGo to next message
sephina
Messages: 14
Registered: March 2006
Junior Member
Hi. Thanks for your reply but I'm still confused about how to go about creating the ALERT and then using the RAISE_FORM_TRIGGER_FAILURE command. Could you please give some more explanation as to how to go about it? Thanks very much! (I'm not experienced with using any of these commands!)
Thanks again.
Sephina
Re: WHEN-VALIDATE-ITEM does not work! Help!! [message #164500 is a reply to message #164472] Thu, 23 March 2006 13:00 Go to previous messageGo to next message
M0nst3r
Messages: 38
Registered: February 2006
Location: Wherever the Money Is
Member
I posted an example of an alert here.

Search the Oracle Form Builder IDE help for more information on creating alerts.

RAISE FORM_TRIGGER_FAILURE is a command used to abort an action. I'm not sure where you got current_date from. I use SYSDATE or FND_STANDARD.SYSTEM_DATE (Oracle Apps).

IF (:release_date > SYSDATE) THEN
  MESSAGE('Please Enter A Valid Date');

  RAISE FORM_TRIGGER_FAILURE;
END IF;


In any case, you really should scrap the WVI trigger to validate the value. Instead, I recommend you change the release_date item's Highest Allowed Value property to $$DBDATE$$.
Re: WHEN-VALIDATE-ITEM does not work! Help!! [message #164542 is a reply to message #164500] Thu, 23 March 2006 22:36 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please refer to ':release_date' as ':blk.release_date', and make sure that it is defined as a date-time field, as a date field will always be today's date with 00:00 as the hours and minutes.

David
Previous Topic: Open Report From Form
Next Topic: Restrict the grid to specific no of rows
Goto Forum:
  


Current Time: Fri Sep 20 05:38:28 CDT 2024