oracleoracle11goracle10goracleformsoracle-fusion-middleware

Check Box Value Not Working in Oracle Forms


I have check box on oracle forms

Value when checked = 'Y'

Value when unchecked = 'N'

By default value unchecked

I create button and write code when check box value 'N' the show message. But when I pressed the button then did not show message. When I changed the value to 'Y' then show message

CODE:

IF :WE_GROUP.CHECK_BOX_HOF = 'N' THEN
 MESSAGE('PLEASE CHECK THE BOX');
 MESSAGE(' ');
END IF;

Solution

  • Forms - as far as I can remember - behaves strange regarding the default checkbox value. Although you say that (if unchecked) it is equal to N, it is actually empty (null). I'd suggest you to try to set the default value upon form startup, for example in WHEN-NEW-FORM-INSTANCE trigger, e.g.

    :we_group.check_box_hof := 'N';
    

    Alternatively/aditionally, in a trigger whose code you posted, use NVL function as

    if nvl(:we_group.check_box_hof, 'N') = 'N' then
       ...
    end if;