Oracle form: How to disable/enable certain blocks or fields in form by switching radio buttons?

Jestem_z_Kozanowa picture Jestem_z_Kozanowa · May 7, 2012 · Viewed 25.9k times · Source

I have three radio buttons in my Oracle form. Ideally, selecting one option would enable block1 and disable block2 and block3. How this could be achieved? Global variable? Which trigger 'listen' to changes of radio button?

DB is Oracle6i.

Any help greatly appreciated.

Answer

DCookie picture DCookie · May 7, 2012

Look into the WHEN-RADIO-CHANGED trigger.

If you've got radio buttons already defined for your form, you know that a radio group is the field you define on your form, and you can define as many radio buttons for a group as desired. Each radio button is associated with a specific value when you build the form.

When one of the radio buttons in a radio group is changed/selected, the when-radio-changed trigger will fire. At that point, depending on which button was pressed, you'll have a value for the radio group. Perform your desired action for the button pressed. So, a skeletal PL/SQL structure to implement this in your trigger could be:

IF :radio_group = '1' THEN
  -- enable/disable as many properties as desired for the blocks
  SET_BLOCK_PROPERTY('block1',property_to_enable,PROPERTY_TRUE);
  SET_BLOCK_PROPERTY('block2',property_to_disable,PROPERTY_FALSE);
  SET_BLOCK_PROPERTY('block3',property_to_disable,PROPERTY_FALSE);
ELSIF :radio_group = '2' THEN
  ...
ELSIF :radio_group = '3' THEN
  ...
END IF;