How to make field in form depended on option field

I have 2 text boxes in my form.

  1. option field (there are 3 options: ‘plan’ , ‘plan1’, ‘plan2’)

  2. text field


how to make field2 ENABLED only when field1 is ‘plan2’ ?? (when ‘plan’ or ‘plan1’ is checked, field2 should be disabled)

Please write below code in OnOpen form and OnAftervalidate trigger of Option field…

CurrForm..ENABLED := = ::Plan2;

thank you