Q: Disable Form Buttons for Specific Time in oracle 10g I want to Disable five Buttons(Student,Parent,Guardian,Employee,Salary) from MENU Form for during non-business hours i-e 8am-1pm(8-13)
I code this in FormBuilder > DatabaseObjects > MyDB(i-e School) >Tables >MENU>Triggers
When i Save it it show error
ERROR:
PDE-UTG007 Trigger contains an error
PLS-00201:identifier'ENABLED'must be declared
BEGIN
IF (TO_CHAR(SYSDATE,'DY') IN ('SAT','SUN')) OR (TO_CHAR(SYSDATE,'HH24:MI') NOT BETWEEN '08:00' AND '13:00') 
THEN
set_item_property('control.Student', enabled, property_false); 
set_item_property('control.Parent', enabled, property_false); 
set_item_property('control.Guardian', enabled, property_false); 
set_item_property('control.Employee', enabled, property_false); 
set_item_property('control.Salary', enabled, property_false); 
RAISE_APPLICATION_ERROR(-20500, 'You can access Database only during normal business hours.');
END IF;
end;

enter image description here

A: This code should be created in Forms' Triggers internally, not in a Database Trigger with converting RAISE_APPLICATION_ERROR to MESSAGE('You can...'); MESSAGE(). You can embed the code within a Procedure of Forms such as
PROCEDURE Disable_Buttons IS
BEGIN
  IF (TO_CHAR(SYSDATE, 'DY','NLS_DATE_LANGUAGE=ENGLISH') IN ('SAT', 'SUN')) OR
     (TO_CHAR(SYSDATE, 'HH24:MI') NOT BETWEEN '08:00' AND '13:00') THEN
    SET_ITEM_PROPERTY('control.Student', enabled, property_false);
    SET_ITEM_PROPERTY('control.Parent', enabled, property_false);
    SET_ITEM_PROPERTY('control.Guardian', enabled, property_false);
    SET_ITEM_PROPERTY('control.Employee', enabled, property_false);
    SET_ITEM_PROPERTY('control.Salary', enabled, property_false);
    MESSAGE('You can access Database only during normal business hours.');
    MESSAGE('');
  END IF;
END;

and call Disable_Buttons from WHEN-NEW-FORM-INSTANCE trigger, along with WHEN-BUTTON-PRESSED triggers of those five buttons as at the top of the existing codes in order to prevent the execution of the rest of the code for already running sessions of applications during those periods.
Or as being more straightforward, you can add the Disable_Buttons into WHEN-NEW-BLOCK-INSTANCE trigger of control block instead of individually adding into the WHEN-BUTTON-PRESSED triggers of those five buttons.
