Ravindra
Ravindra

Reputation: 61

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

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;

Upvotes: 0

Views: 916

Answers (2)

Littlefoot
Littlefoot

Reputation: 143103

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.

Upvotes: 2

Barbaros Özhan
Barbaros Özhan

Reputation: 65408

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

Upvotes: 1

Related Questions