oracle-databaseconditional-statementsoracleforms

How to make a button conditional in Oracle Forms


I am very new to oracle forms and I have to make a button conditional on my form.

The visibility of the button depends on user role.

The button should be visible only to a user whose role is 'admin'. If the role is 'super admin' the button should not be visible.

Thanks!


Solution

  • Use the set_item_property built-in and its displayed property.

    You didn't explain how to know who is who, so I'll guess that it is contained in a global variable, so you'd then

    if :global.user_role = 'super_admin' then
       set_item_property ('employees.btn_create_department', displayed, property_false);
    elsif :global.user_role = 'admin' then
       set_item_property ('employees.btn_create_department', displayed, property_true);
    end if;
    

    For more info, open Forms Online Help system and read about that procedure.