Home > database >  how to promt a message if a field is empty in oracle forms
how to promt a message if a field is empty in oracle forms

Time:04-08

How to prompt a message if field is empty in oracle forms i'm not sure if it works and the trigger i'm using is when-validate-item

begin
  if date = NULL then
    message('please enter issue date')
  else
    null;
  end if;
end;

CodePudding user response:

Just modify the code a little bit as

  • converting date = NULL to :date IS NULL, since : prepended to the field's name within the code

  • add an extra message(''); (exactly this with blank padded argument) if a pop-up message box needed

  • don't forget the semicolon at the end of the line of the current message(....)

as invoking from one of the WHEN-VALIDATE-ITEM or WHEN-NEW-ITEM-INSTANCE triggers

CodePudding user response:

From my point of view:

  • you should edit field's properties and set the required property to yes and let Forms worry about it

  • if you insist on reinventing the wheel, then don't just display a message as it is pretty much useless - user can ignore it. Raise an error, instead

    if :block_name.item_name is null then
        message('Please, enter issue date');
        raise_form_trigger_failure;
    end if;
    

    Put that piece of code into the WHEN-VALIDATE-ITEM trigger.

  • Related